Automatically change insurance quantity based on cart total [closed]

Try this: add_action(‘woocommerce_cart_totals_after_shipping’, ‘wc_shipping_insurance_note_after_cart’); function wc_shipping_insurance_note_after_cart() { global $woocommerce; // Get the number of products in the cart $cart_item_count = WC()->cart->get_cart_contents_count(); $product_id = 7597; // ID of the insurance product // Check if the insurance product is already in the cart $found = false; foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) { $_product = … Read more

How do I unset category from a product in wordpress by code

To remove all category from a WooCommerce product, you can use the wp_set_object_terms() function. Here is an example of how you can use wp_set_object_terms() to remove categories from a product: // Set the product’s categories to an empty array $categories = array(); wp_set_object_terms( $product->ID, $categories, ‘product_cat’ ); If you want to remove a specific category, … Read more

inner-wrap div pushing custom table far down on page

Part of the problem is that you’re running (or re-running) get_header() after your table, thus putting all of the header content into the body of page after the table HTML has started. <?php /* Template Name: Custom Table Is this part even needed for you? If this is a complete template, then probably, but if … Read more