Woocommerce: relevancy based related products
Woocommerce: relevancy based related products
Woocommerce: relevancy based related products
You shouldn’t use a SQL query. You can do this programatically. $price = get_post_meta( $product_id, ‘_price’); $price += 100; // use -= 100 to subtract update_post_meta($product_id, ‘_price’, $price); update_post_meta($product_id, ‘_regular_price’, $price);
Does your single-product.php contain this? <?php /** * woocommerce_before_main_content hook. * * @hooked woocommerce_output_content_wrapper – 10 (outputs opening divs for the content) * @hooked woocommerce_breadcrumb – 20 */ do_action( ‘woocommerce_before_main_content’ ); ?>
It looks like the page lives in the template parts of the theme folder. Can you locate product.page.php or content.product.php file? The easiest solution is navigate to the WordPress UI interface –> Pages –> “product page”, choose a feature image. This product image looks like a dynamic feature image you can easily change.
Am I correct that you’re meaning products as in WooCommerce products? If so: Right before WooCommerce returns the related products for a current product(if you’re not on a product page you could define a post_id yourself). It uses a filter which you can hook into. $related_posts = apply_filters( ‘woocommerce_related_products’, $related_posts, $product_id, array( ‘limit’ => $limit, … Read more
As you can see from this file, find the file where your loop is defined, then create or copy over the template file for individual loop items to your theme folder. In the example from the link, this would be content-product.php, located inside the /plugins/woocommerce/templates folder. You can then fully customize the file to your … Read more
I found a solution using this plugin. It’s very easy. If you want to display the setup fee in your product description, use the following code: $id = get_the_ID(); $fee_name = get_post_meta( $id, ‘product-fee-name’, true ); $fee_amount = get_post_meta( $id, ‘product-fee-amount’, true ); echo $fee_name . ‘ – ‘ . $fee_amount;
You can create “add to cart” links for WooCommerce using this pattern on simple links: http://example.com/cart/?add-to-cart=<product ID>&quantity=<number of quantity> This example will work with simple products. If you want to use products with variations you need to add some more values to the URL like: http://example.com/cart/?add-to-cart=123&variation_id=456&attribute_pa_colour=black If you enter the slug of the cart page … Read more
Woo Discount Rules can does that. https://wordpress.org/plugins/woo-discount-rules/ Free version works if you doesn’t require the rules to be apply to certain customer or roles
You should get the subtotal like this: global $woocommerce; $cart_subtotal = $woocommerce->cart->get_cart_subtotal(); From here. So you will can do something like this: add_filter( ‘woocommerce_product_tax_class’, ‘big_apple_get_tax_class’, 1, 2 ); function big_apple_get_tax_class( $tax_class, $product ) { global $woocommerce; $cart_subtotal = $woocommerce->cart->get_cart_subtotal(); if ( $cart_subtotal <= 110 ) $tax_class=”Zero Rate”; return $tax_class; }