WooCommerce apply shipping rates based on price
Try this plugin Advanced Flat Rate Shipping Method WooCommerce. Hope this helps.
Try this plugin Advanced Flat Rate Shipping Method WooCommerce. Hope this helps.
add_filter(‘body_class’, ‘SE_314220_custom_outofstock_class’); function SE_314220_custom_outofstock_class ($classes) { global $post; if($post->post_type !=”product”) return $classes; $product = wc_get_product( $post->ID ); if($product->get_stock_quantity() ==0) $classes[] = ‘OUT-OF-STOCK’; return $classes; }
get_the_terms() returns FALSE if there are no terms in the taxonomy, so you could check for that. $authors = get_the_terms( $post->ID , ‘product_author’ ); if ( FALSE != $authors ) : // Do something endif; If you want to avoid displaying empty terms, ie. terms that have no objects attached to them, use get_terms() instead, … Read more
I finally got it to work using this code: I’m using a php class to make an organized workflow so don’t mind the public on functions… First I register my filters like this: public function registerFilters() { add_filter( ‘woocommerce_default_address_fields’, array($this, ‘woo_new_default_address_fields’), 10, 2); add_filter(‘woocommerce_order_formatted_billing_address’, array($this, ‘woo_custom_order_formatted_billing_address’), 10, 2); add_filter(‘woocommerce_formatted_address_replacements’, array($this, ‘myFunction’), 10, 2); add_filter(‘woocommerce_localisation_address_formats’, array($this, … Read more
Try to get category info using $category = get_queried_object(); $cpt_cat = $category->term_id; $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 10, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, ‘terms’ => $cpt_cat, ), ), ); // Custom query. $query = new WP_Query( $args ); if ( $query->have_posts() ) { global $wpdb; /* Start … Read more
Use this: function your_function() { if ( is_front_page() ) { $output = … } else{ $output = … } return $output; } p.s. It’s not needed to use is_home(). Whoever needs the technical details, see is_front_page and is_home
You can use product attributes. You can configure them in the back-end, and then add something like this to your template: <?php $sizes = $product->get_attribute( ‘size’ ); $sizes = explode(“, “,$sizes); ?> <?php if($sizes[0]!=”){ // if product sizes are available ?> <span class=”product-size-label”>Choose your size:</span> <select class=”product-size”> <?php foreach($sizes as $size){ ?> <option><?php echo $size; … Read more
So I think that now you just have to add the proper css. On both elements (price and button) place: display: inline-block; You can also try: float: left;
You already have the right “action”, which is woocommerce_after_cart_contents. But when I tried the markup you used: function quality_certificates(){ echo ‘<tr>TEST</tr>’; } this was the visual output: (I actually initially tested with the Twenty Seventeen theme; sorry about that. But this one is tested with Storefront) Then I started thinking that the problem might be … Read more
WooCommerce Email template already has access to $order variable. You simply need to add it to shortcode atts, like this do_shortcode(‘[sample_test name=”additional_gift_msg” order_id=’ . $order->get_id() . ‘]’); Then in the shortcode callback: function th_email_shortcode_handler( $atts ) { // get the $order_id $order_id = $atts[‘order_id’]; // create the order object if needed $order = new WC_Order( … Read more