Image as Sales Badge
Change your image url to “/wp-content/uploads/2018/01/in-stock.png” That way even if you change servers (or changed domain name), as long as the filepath doesn’t change from wp-content, you’ll still be safe.
Change your image url to “/wp-content/uploads/2018/01/in-stock.png” That way even if you change servers (or changed domain name), as long as the filepath doesn’t change from wp-content, you’ll still be safe.
I have a solution to this, at least in my specific case. Solution get_template_part() did work in the end, but ACF needed the ID of the post (the Shop page). When calling ACF fields from outside of the loop you need to specify a post ID. For all of the other pages on the site … Read more
add_action( ‘wp’, ‘vn_remove_related_products’ ); function vn_remove_related_products() { if ( is_product() && has_term( array(‘workshops’, ‘events’), ‘product_cat’ ) ) { remove_action( ‘woocommerce_after_single_product_summary’, ‘woocommerce_output_related_products’, 20 ); } } Function has_term() can pass first parameter as array with terms.
Disable default Related Products and try this (Add custom code to the functions.php) add_action( ‘woocommerce_after_single_product_summary’, ‘custom_output_product_collection’, 12 ); function custom_output_product_collection(){ ## — YOUR SETTINGS — ## $attribute = “attribute_slug”; // <== HERE define your attribute slug $limit = “5”; // <== Number of products to be displayed $cols = “5”; // <== Number of columns … Read more
Well, what it works for me in this case was this code add_filter( ‘woocommerce_add_to_cart_redirect’, ‘redirect_add_to_cart’ ); function redirect_add_to_cart() { if ( isset( $_POST[‘add-to-cart’] ) ) { $url = wc_get_checkout_url(); return $url; } } It redirects if it is a product but if you are in the shop page it wont redirect, of course if you … Read more
Within the loop the best way to check if the result is a product would be to check the value of get_post_type(): if ( get_post_type() === ‘product’ ) { } As you say, is_woocommerce(), is_product() and is_search() are for checking which type of page is being viewed regardless of the current item in the loop.
WooCommerce have moved this setting to the WordPress Customizer. From your WordPress admin area, browse to: Appearance -> Customise Then, from within the customiser, you can find the setting here: WooCommerce -> Product Catalogue and simply change the order under the option ‘Default Product Sorting’
For custom taxonomies, including Product Categories, you should use the tax_query argument: $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 12, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_cat’, ‘terms’ => 40, ), ), );
// Missing product redirect to product category add_filter( ‘rewrite_rules_array’, function( $rules ) { $new_rules = array( ‘shop/([^/]*?)/page/([0-9]{1,})/?$’ => ‘index.php?product_cat=$matches[1]&paged=$matches[2]’, ‘shop/([^/]*?)/?$’ => ‘index.php?product_cat=$matches[1]’, ); return $new_rules + $rules; } );
A couple of different hings are going on according to your log: The “deprecated” functions mean that you’re using a theme that calls old functions. You need to update your theme to be compatible with the version of Woocommerce you are running. This doesn’t break your site, but should be addressed. The “warning” and “error” … Read more