WooCommerce: Add Payment Gateway Field to Webhooks [closed]

Thanks, will do next time. I figured this one out: function my_custom_wc_api_order_response( $order_data, $order, $fields ) { $customer_info = get_post_meta( $order->id, ‘_customer_info’, true ); $order_data[‘payment_details’][‘customer_info’] = $customer_info; // Apply filters if necessary if ( $fields ) { $order_data = WC()->api->WC_API_Customers->filter_response_fields( $order_data, $order, $fields ); } return $order_data; } add_filter( ‘woocommerce_api_order_response’, ‘my_custom_wc_api_order_response’, 10, 3 );

Woocommerce checkout field maxlength, make input number field only (postcode)

By the time woocommerce_checkout_fields filter is run, the arrays for billing and shipping have already been created. You can see that here: https://docs.woothemes.com/wc-apidocs/source-class-WC_Checkout.html#101 If you want to effect the default fields, use this hook. function wpse215677_checkout_fields ( $fields ) { $fields[‘postcode’][‘maxlength’] = 4; return $fields; } add_filter(‘woocommerce_default_address_fields’, ‘wpse215677_checkout_fields’); If you want to adjust just the … Read more

Remove action added through function

Found the answer here: http://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623 <?php function child_remove_parent_function() { remove_action( ‘woocommerce_before_main_content’, ‘mod_output_content_wrapper’, 10 ); } add_action( ‘wp_loaded’, ‘child_remove_parent_function’ ); ?> Explanation is in the link.

Woocommerce – Display active variation product price [closed]

I was able to come up with a solution. It displays the variant price below/adjacent to the radio buttons. Display variant price (when given an ID): function get_product_variation_price($variation_id) { global $woocommerce; $product = new WC_Product_Variation($variation_id); return $product->get_price_html(); // Works. Use this if you want the formatted price } Find variant ID, send to function get_product_variation_price, … Read more

WooCommerce shipping – Different product different shipping? [closed]

Create shipping classes for each of your product variations which require one. On your product page, add the attributes for the product, then add the variations, based on the added attributes. Once loaded, you may select the individual product variations to modify price, size, weight, inventory, and shipping class for each specific product variation. To … Read more