Sha256: 0fcb58f08fba1dff47d2f69d2ef680e0aa92953a68b0ae3d98929a953bec6c71
Contents?: true
Size: 636 Bytes
Versions: 5
Compression:
Stored size: 636 Bytes
Contents
module SpreePluggto module Spree module ProductDecorator # https://guides.spreecommerce.org/developer/customization/logic.html # self.prepended is needed to access class-level methods, like has_many, scopes and callbacks def self.prepended(base) base.after_create :upsert_pluggto_product, if: :sync_with_pluggto? base.after_update :upsert_pluggto_product, if: :sync_with_pluggto? end private def upsert_pluggto_product ::SpreePluggto::UpsertProductJob.perform_later(self.id) end end end end Spree::Product.prepend(SpreePluggto::Spree::ProductDecorator)
Version data entries
5 entries across 5 versions & 1 rubygems