Error do_shortcode In WooCommerce Template

I solved this with dirty way.. hope someone else can provide more efficient solution, my final working code for problem above: $shortkode=”[zendesk_request_form size=”3″ group=”extra-field” subject=”Quotation For -wkwkwk-“]”; $shortkode = do_shortcode( $shortkode ); add_action(‘woocommerce_single_product_summary’, ‘quotation_form’, 61); function quotation_form() { $produk = get_the_title(); global $shortkode; $shortkode = str_replace(“-wkwkwk-“, $produk, $shortkode); echo $shortkode; } So i move out … Read more

Get woocommerce catogry

It’s not working because you didn’t pass the Woocoomerce’s Product category taxonomy. By default get_categories() function will returns all terms data of default category taxonomy, if you did’t mention specific taxonomy slug inside the arguments list. So, To retrieve the terms data of any specific taxonomy, We must have to pass the slug of that … Read more

Pass parameters to function through an action

add_action() and add_filter() take 4 params: string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1. So, the function you are hooking to takes more than 1 param, then just pass the number of params it accepts as the 4th param to add_action(). In your case, add_action (‘my_action’, ‘my_function’, 10, 2) ;

How do you add custom metadata to WooCommerce orders? Specifically a second external order ID

you can use woocommerce_checkout_update_order_meta hook to update order meta. Please check sample code add_action(‘woocommerce_checkout_update_order_meta’, ‘custom_checkout_field_update_order_meta’); function custom_checkout_field_update_order_meta($order_id) { session_start(); if ($_SESSION[‘mapics_order’]) update_post_meta($order_id, ‘mapics_order’, esc_attr(htmlspecialchars($_SESSION[‘mapics_order’]))); }

How do I change the initial quantity of a product in woocommerce?

You can use the woocommerce_quantity_input_args filter: function wpse_292293_quantity_input_default( $args, $product ) { $args[‘input_value’] = 2; return $args; } add_filter( ‘woocommerce_quantity_input_args’, ‘wpse_292293_quantity_input_default’, 10, 2 ); When the quantity input is output, it’s output with the woocommerce_quantity_input() function. This function accepts several arguments including the default value for the input. This filter lets you replace values in … Read more