Tag Info

New answers tagged

1

i currently work on a woocommerce v2.1.12 shop and it seems they chaged that behavior. my ajax url to add items to the cart has to look like this: ?add-to-cart=[PRODUCT-ID]&variation_id=[VARIATION-ID]&attribute_[ATTRIBUTE-NAME]=[ATTRIBUTE-SLUG]&attribute_[ATTRIBUTE-NAME]=[ATTRIBUTE-SLUG] example: ...


4

You could check to see if the 'WooCommerce' class exists, then run the code that requires WooCommerce. <?php if ( class_exists( 'WooCommerce' ) ) { // code that requires WooCommerce } else { // you don't appear to have WooCommerce activated } ?>


1

Don't do it. You will need the original images to regenerate the smaller version when you will want to change the theme, and disk space is so cheap there is no real need to conserve it. A better alternative is to limit image upload size and force the user to photoshop the image before uploading, something that most likely will also improve the result of ...


2

You should be able to do this with the same filter that is talked about here. The full-size images are being kept by WordPress. It's not really a WooCommerce thing. As well as the settings for images in WooCommerce you will also need to set minimum image size in WordPress's Settings>Media... Then this script (see the link above for complete discussion) ...


0

the best solution I found was on a treat on wp forums I come out with this little piece of code which I put in the meta.php file: $terms = get_the_terms( $post->ID, 'pa_model' );//attribute's name after the prefix pa_ if ( $terms && ! is_wp_error( $terms ) ) : foreach ( $terms as $term ) { echo $authorvalue->name; } endif; ...


0

the_posts filters run on set of posts after they have been queried. The filter you should be using is pre_get_posts. You can work through its documentation in Codex for explanations and examples of correct usage (your snippet doesn't look too good, but might be be because of details omitted).


0

I got it already! Just paste this code in theme function.php. Got the answer from here: Woocommerce - Hide “add to cart” on free products function wpa_109409_is_purchasable( $purchasable, $product ){ if( $product->get_price() == 0 ) $purchasable = false; return $purchasable; } add_filter( 'woocommerce_is_purchasable', ...


2

Use get_current_blog_id() to check the current site. To run on site 2 only, use this: function new_meta_values($order_id) { if ( 2 !== get_current_blog_id() ) return; /* the rest of the function code */ }


0

Deleting images using plugin: You can use this plugin, it will search your database and look if image is inserted into any post (in content, as featured image, in any custom field, anywhere...) or as background... If image is not used anywhere it will give you option to delete it. You will get list of all images on your site not used anymore, so you can ...


1

The problem is that your code, especially the global $post; and then $post->ID part is getting the $post_id of the page you are on from the $post global variable, not of the product(s) in your cart, which would be what you are looking for. Aside from that, the $args parameter of wp_get_post_terms has no argument taxonomy, besides you already ...


0

OK, So this is somewhat embarrassing and sorry for wasting everyone's time. When I narrowed down that the issue was just with the products post_type I went and checked what version of Woocommerce was being used and found that it was way out of date. After updating all Woocommerce plugins to the latest versions the product search worked. One of the first ...



Top 50 recent answers are included