Skip to content

Instantly share code, notes, and snippets.

@ignacio-chiazzo
Last active March 14, 2021 00:25
Show Gist options
  • Save ignacio-chiazzo/677bb5797160c2d06659747f36240900 to your computer and use it in GitHub Desktop.
Save ignacio-chiazzo/677bb5797160c2d06659747f36240900 to your computer and use it in GitHub Desktop.
# Consumer 1 Logic
require 'pricing_engine'
module ShopifyCore
class PricingRepository < PricingEngine::PricingRepositoryInterface
def variants_by_ids(ids)
variants = ProductVariant.where(id: ids).select(:title, :price).limit(50)
variants.map { |variant| PricingEngine::Schema::Variant.new(title: variant.title, price: variant.price) }
end
def variants_by_titles(titles)
variants = ProductVariant.where(title: titles).select(:title, :price).limit(50)
variants.map { |variant| PricingEngine::Schema::Variant.new(title: variant.title, price: variant.price) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment