• mischael1

    (@mischael1)


    Good health!
    There are variations in the packaging (carton and pack).
    That is, only two options for each product.
    Each variation, it is necessary to assign an individual barcode.
    It turns out, as would the associated variation.

    Example.
    There are products A and B. each has an identical variation of the product and the box. And there are different variations of barcodes: — barcode 001 and 002, B — bar codes 003 and 004.
    When you select the box of the product And the person automatically chooses the barcode and 001.
    If you choose the package of the product And the person automatically chooses and barcode 002.
    When you select the box of the product B automatically selects and barcode 003.
    If you choose the package of the product B automatically selects and barcode 004.

    How it can be implemented?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mischael1

    (@mischael1)

    I asked this same question on the Russian forum. I was there the man replied, but could not explain for the newcomers what he has in mind. Maybe our correspondence will help you to find the answer here

    Support response:
    “If the attribute is “barcode” firmly tied to variations of the property “package”, I would not use this attribute for variations. I would attribute the variations in banal post_meta. In my opinion, it is easier and less load for the engine.”

    My update:
    “How to do it?”

    Support response:
    “The conclusion of the field on the hook ‘woocommerce_variation_options’ and keeping the value of the hook ‘woocommerce_save_product_variation’.”

    For further questions I have not answered. And I don’t know which button To push to implement

    The output fields on the hook ‘woocommerce_variation_options’

    And what to do for

    retention values for hook ‘woocommerce_save_product_variation’

    Or is it from the admin panel is not done? If it is necessary to dig the code, what file? And what exactly to register? Then “grandma with glasses” enter barcode values into commodities?

    If you go to the product edit page > Product Data Section > Variations tab

    for each variation there is a field called SKU and you could use this for your barcode.

    The SKU data is saved in the postmeta table. This is normal WooCommerce behaviour.

    Thread Starter mischael1

    (@mischael1)

    1. I use SKU for another id.
    2. If I’m not mistaken the SKU is not involved in variations and for different variations of the same product SKU will also be the same.
    And I want each different barcode your own individual.

    The parent product can have a SKU. Its also possible to set a SKU for each variation in the variation setup form. If the variation SKU is left blank, the variation will take the parent product SKU.

    If you want to make a new field to store barcodes, try this plugin:
    https://www.ads-software.com/plugins/wc-fields-factory/

    You can create a custom admin field for barcodes and set it appear on the variations tab. This will give you one field per variation to store its barcode.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘related attributes of goods’ is closed to new replies.