Home › Forums › General Issues › Woocommerce Attribute Function Question › Reply To: Woocommerce Attribute Function Question
Hi Michael,
Using a custom function hooked to the woocommerce_before_order_itemmeta action hook, you could make it possible to achieve what you are looking for:
add_action( 'woocommerce_before_order_itemmeta', 'storage_location_of_order_items', 10, 3 );
function storage_location_of_order_items( $item_id, $item, $product ){
// Only in backend Edit single Order pages
if( current_user_can('edit_shop_orders') ):
// The product ID (in WooCommerce 3+)
$product_id = $product->get_id();
// Get your ACF product value (replace the slug by yours below)
$acf_value = __('Stored in: ') . get_field( 'BinLocation', $product_id );
// Outputing the value of the "location storage" for this product item
echo '<div class="wc-order-item-custom"><strong>'. $acf_value .'</strong></div>';
endif;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.