write custom woocommerce templates and forms

To answer your second question you’ll have to properly enqueue the Bootstrap 4 styles and scripts: Including CSS & JavaScript | Theme Development From there you either have to add existing WooCommerce classes to your BootStrap CSS or add BootStrap classes to your WooCommerce templates (preferred/recommended). As for the templates, it really depends on which … Read more

Hide “Delete Note” link in Order Notes Panel

You can try adding this in your functions.php file: add_action(‘admin_head’, ‘hide_delete_note_from_edit_order’); function hide_delete_note_from_edit_order() { $screen = get_current_screen(); if ($screen->post_type === “shop_order” && $screen->base === “post”) { echo ‘<style>a.delete_note { display:none; }</style>’; } }

Can I set a custom “alt” attribute with woocommerce_get_product_thumbnail()?

You can’t with woocommerce_get_product_thumbnail(), but this will give you the exact same result: global $product; $image_size = apply_filters( ‘single_product_archive_thumbnail_size’, ‘woocommerce_thumbnail’ ); $custom_alt=”Put your custom alt text here.”; return $product ? $product->get_image( $image_size, [ ‘alt’ => $custom_alt ] ) : ”;

Replace one coupon to another after coupon added

This requires to use an action hook like woocommerce_calculate_totals that is related to cart and Ajax enabled, because it will handle all changes made by the customer in cart page: add_action( ‘woocommerce_calculate_totals’, ‘discount_based_on_cart_subtotal’, 10, 1 ); function discount_based_on_cart_subtotal( $cart ) { if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) return; // Avoiding hook repetitions … Read more

Change sign up fee in cart for subscription products WooCommerce

add_action( ‘woocommerce_before_calculate_totals’, ‘change_subscription_signup_fee’, 1000, 1 ); function change_subscription_signup_fee( $cart ) { if (is_admin() && !defined(‘DOING_AJAX’)) return; if ( did_action( ‘woocommerce_before_calculate_totals’ ) >= 2 ) return; // Loop through cart items foreach ( $cart->get_cart() as $cart_item ) { // Check that product custom cart item data “alredy_have_number” exist and is true if( isset($cart_item[‘alredy_have_number’]) && $cart_item[‘alredy_have_number’] ) … Read more

Set post categories to include parents when setting child category

This will check to see if there is a hierarchy and set all parent categories as checked. This function assumes that if there’s multiple categories already set, then don’t do the function, since the categories would be correct if multiples are set. function set_product_parent_categories( $post_id ) { $category = wp_get_post_terms( $post_id, ‘product_cat’ ); // If … Read more