Woocommerce – Display product category of product in Orders page

Add Below Code in Your Theme function.php function action_woocommerce_admin_order_item_headers( ) { ?> <th class=”item sortable” colspan=”2″ data-sort=”string-ins”><?php _e( ‘Item category’, ‘woocommerce’ ); ?></th> <?php }; // define the woocommerce_admin_order_item_values callback function action_woocommerce_admin_order_item_values( $_product, $item, $item_id ) { ?> <td class=”name” colspan=”2″ > <?php $termsp = get_the_terms( $_product->id, ‘product_cat’ ); if(!empty($termsp)){ foreach ($termsp as $term) { … Read more

Woocommerce: Extra added country field not taking value from database

Unless I’m missing something, you’re collecting the data through the post, validating it, and storing it, but I’m not seeing how you intended to display the billing_country in the checkout template. Since the billing_country data is stored in the user meta, you could display it in your checkout template using get_user_meta: <?php $billingCountry = get_user_meta($customer_id, … Read more

Override function

Here is the code for overriding price of product in cart add_action( ‘woocommerce_before_calculate_totals’, ‘add_custom_price’ ); function add_custom_price( $cart_object ) { $custom_price = 10; // This will be your custome price foreach ( $cart_object->cart_contents as $key => $value ) { $value[‘data’]->price = $custom_price; } }