How to customize product at cart page

use this function and edit cart page template /** * Display engraving text in the cart. * * @param array $item_data * @param array $cart_item * * @return array */ function iconic_display_engraving_text_cart( $item_data, $cart_item ) { if ( empty( $cart_item[‘iconic-engraving’] ) ) { return $item_data; } $item_data[] = array( ‘key’ => __( ‘Engraving’, ‘iconic’ ), … Read more

How to neutralize a parent theme php template?

I’m assuming that with ‘neutralize’ you mean de-register or remove, such that WC doesn’t see (or recognize) the file and functions as it would have without the woocommerce.php-file being there. This answer proposes a code in which your child theme (by code) physically deletes the parent theme file. There’s also a questions here that seems … Read more

Shortcodes in billing fields doesn’t work

The “official” answer is that you need to use do_shortcode() to process the shortcode as you can’t just simply apply a shortcode within the code. Here’s your original code with the “official” do_shortcode() way: add_filter( ‘woocommerce_checkout_fields’, ‘set_checkout_field_input_value_default’ ); function set_checkout_field_input_value_default($fields) { $fields[‘billing’][‘billing_city’][‘default’] = do_shortcode( ‘[geoip_detect2 property=”city”]’ ); $fields[‘billing’][‘billing_state’][‘default’] = do_shortcode( ‘[geoip_detect2 property=”mostSpecificSubdivision”]’ ); return $fields; … Read more

Removing Product from Woocommerce checkout page using Ajax

Use jQuery(‘body’).trigger(‘update_checkout’); on your javascript e.g on ajax success/response it will update checkout page with ajax. $.ajax({ type: ‘POST’, dataType: ‘json’, url: wc_checkout_params.ajax_url, data: { action: “product_remove”, product_id: product_id, cart_item_key: cart_item_key }, success: function(response) { if ( ! response || response.error ) return; var fragments = response.fragments; // Replace fragments if ( fragments ) { … Read more