Class: EPlat::Shopify::GraphQL::V202501::Input::Product::VariantsBulk

Inherits:
EPlat::Shopify::GraphQL::V202501::Input
  • Object
show all
Defined in:
lib/e_plat/resource/platform_specific/shopify/graph_q_l/v_2025_01/input/product/variants_bulk.rb

Constant Summary collapse

USES_ELEMENT_NAME_AS_INPUT_ROOT_KEY =
false
SUPPORTED_FIELDS =
%w[
  barcode
  compareAtPrice
  id
  inventoryItem
  inventoryPolicy
  inventoryQuantities
  mediaSrc
  metafields
  optionValues
  price
  taxCode
  taxable
].freeze
SUPPORTED_NAMED_ARGUMENT_FIELDS =
{
  variants: %w[
    barcode
    compareAtPrice
    id
    inventoryItem
    inventoryPolicy
    inventoryQuantities
    mediaSrc
    metafields
    optionValues
    price
    taxCode
    taxable
  ],
  inventory_item: %w[
    cost
    countryCodeOfOrigin
    countryHarmonizedSystemCodes
    harmonizedSystemCode
    measurement
    provinceCodeOfOrigin
    requiresShipping
    sku
    tracked
  ],
  option_values: %w[
    name
    optionId
    linkedMetafieldValue
    optionId
    optionName
  ]
}.with_indifferent_access.freeze

Class Method Summary collapse

Class Method Details

.mutation_input(product, action) ⇒ Object



54
55
56
57
58
59
# File 'lib/e_plat/resource/platform_specific/shopify/graph_q_l/v_2025_01/input/product/variants_bulk.rb', line 54

def self.mutation_input(product, action)
  new(
    product_id: EPlat::Product.formatted_id(product.id),
    variants: product.as_json["product"]["variants"]
  ).query_input
end