Sha256: ec2207e95f5f0bc245587c859e8c6fee26b9b59be8da83748e3030dcf1c5bd40

Contents?: true

Size: 416 Bytes

Versions: 1

Compression:

Stored size: 416 Bytes

Contents

class Plugins::Ecommerce::ProductService
  def initialize(site, product, variation_id = nil)
    @site = site
    @product = product
    @variation_id = variation_id
  end
  
  attr_reader :site, :product, :variation_id
  
  def available_qty
    if variation_id.present?
      product.decorate.get_variation(variation_id).qty || 0
    else
      product.get_field_value('ecommerce_qty').to_f || 0
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaleon_ecommerce-1.2 app/services/plugins/ecommerce/product_service.rb