Get a custom field from a variable product.
-
Hi,
First of all: great plugin!
I ran into a problem when editing the template.
I have added 2 fields to each product variable.
So lets say you have a T-SHIRT with 3 sizes: M, L, XL. Each of those sizes has it’s own EAN Code and SKU Code.On the cart and in the regular order emails I can echo those fields by doing this:
<?php $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); $getean = get_field( "_ean_code", $_product->variation_id ); $getsku = get_field( "_var_sku", $_product->variation_id ); echo '<dl class="variation"><dt class="ean-cart">EAN:</dt><dd class="ean-cart"><p>' . $getean . '</p></dd></dl>'; echo '<dl class="variation"><dt class="sku-cart">SKU:</dt><dd class="sku-cart"><p>' . $getsku . '</p></dd></dl>'; ?>
Now, I know you use a different global variable, I tried a few different codes with this variable and whatnot, I also used your custom field explanation. but I can’t seem to reach those fields….
Any pointers? Any help would be appreciated ??
Thanks in advance.
https://www.ads-software.com/plugins/woocommerce-pdf-invoices-packing-slips/
- The topic ‘Get a custom field from a variable product.’ is closed to new replies.