Tag Info

Hot answers tagged

8

You need to create a new loop for that. Here's the code I use for displaying products from a specific category on the home page: <ul class="products"> <?php $args = array( 'post_type' => 'product', 'posts_per_page' => 1, 'product_cat' => 'shoes', 'orderby' => 'rand' ); $loop = new WP_Query( $args ); while ( ...


7

luckily woocommerce has many hooks, this removes prices and buttons: remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ...


4

Its pretty easy one you have worked out the data added in the post meta. Trouble I am having is adding downloadable products to the store. below is the code i am using it lists all the post meta that is used by woo commerce. This publishes a product however the download link will not attach. Originally when i started i made an error with the array that ...


3

From the __get() method in the WC_Order class you can see that the user_id property is taken from/stored as _customer_user post meta for the order in question. /** * __get function. * * @access public * @param mixed $key * @return mixed */ public function __get( $key ) { // Get values or default if not set if ( 'completed_date' == $key ) { ...


3

Capabilties - for guests? Your problem is that a guest doesn't have any capabilities. And when posts get processed, they need to pass certain checks. One is unfiltered_html. From Codex: Allows user to post HTML markup or even JavaScript code in pages, posts, comments and widgets. Note: Enabling this option for untrusted users may result in their ...


3

You have differents languages in your site, although your frontend is not multilingual, you serve one language in frontend and another in backend. Ajax in Wordpress is processed in the "admin area" (wp-admin/admin-ajax.php), so the reponse of an ajax request will be in the language defined in the admin area. "English" in your case. I don't know exactly how ...


3

Extending the above code (thanks Ewout), the following code will get rid of all prices and 'add to cart' buttons on all woocommerce products, as well as provide an explanation as to why. I needed the code for a website that offers direct selling products and to comply with their rules, I cannot show prices to the general public. Add the filter to your ...


3

WooCommerce questions are off-topic, but since reviews are merely comments, I think we can make the case that ordering comments is still on-topic. wp_list_comments() has a reverse_top_level parameter that will set the most recent comment first and then go backwards. Assuming it works like I think it should then you'd want to add this parameter to ...


2

You can add this snippet below to your themes functions file to create the message you want displayed. (For all Woocommerce conditional options, visit their codex here: http://docs.woothemes.com/document/conditional-tags/) add_filter ('the_content', 'royal_woocommerce_maintenance'); function royal_woocommerce_maintenance($content) { if( is_woocommerce() ...


2

Woocommerce does hijack the main query on the shop page / product queries, so it's possible that you're used to referencing your custom fields within the loop or in some other context where the global $post is the page you are on, but in this case the contents of $post will be Woocommerce products and not the page. If this is for your base shop page you ...


2

Found solution for this problem. It turned out that woocommerce affects post_type query variable in pre_get_posts filter without checking that another post_type has been requested. It's done in WC_Query.product_query method: if ( ! $q->is_tax( 'product_cat' ) && ! $q->is_tax( 'product_tag' ) ) $q->set( 'post_type', 'product' ); Fix ...


2

I couldn't find this documented anywhere, but the solution is pretty simple. In single_product_review.php, the arguments passed to wp_list_comments are filtered: wp_list_comments( apply_filters( 'woocommerce_product_review_list_args', array( 'callback' => 'woocommerce_comments' ) ) ); by adding reverse_top_level to the arguments, the order is ...


2

I never understood this either from woocommerce... I'd expect a 'product description' as the main post info and then perhaps 'detailed description' or 'additional product information' in the tab. in templates/single-product/short-description.php replace if ( ! $post->post_excerpt ) return; ?> <div itemprop="description"> <?php echo ...


2

You're _doing_it_wrong, as $product is an object. I'm pretty sure you want something like this: $args = array( 'post_type' => 'product', 'posts_per_page' => 4, ); $featured_query = new WP_Query($args); if ($featured_query->have_posts()) { while ($featured_query->have_posts()) { $featured_query->the_post(); ?> ...


2

I have been working on this myself with very little coding experience. So far I have found that you can add in another value but you need to update a few of the files in the woocommerce template. In the single-product-reviews.php, just repeat the code from the <p> to </p>. See where I have added in the newrating star select if ( ...


2

I got it working for my situation by using update_post_meta and wp_insert_post. Because I already setup my attributes and terms all I needed was a way to add to the above code so that when the product is created it not only will assign the attributes to the product but insert them as variations in the database. Here is my solution: //insert variations ...


2

wp_enqueue_style supports dependencies. So, if you make the WooCommerce style a dependency for your new stylesheet then your stylesheet will always load after the WooCommerce stylesheet. Something like this ought to work, but it is untested: function enqueue_style_after_wc(){ $deps = class_exists( 'WooCommerce' ) ? array( 'woocommerce-layout', ...


2

I think I fixed the issue with the following extended function in my plugin: function localize_backend( $locale ) { // set langauge if user is in admin area if( defined( 'WP_ADMIN' ) || ( isset( $_REQUEST['pwd'] ) && isset( $_REQUEST['kau-boys_backend_localization_language'] ) ) ){ // ajax call from frontend if ( ...


2

20 is the priority. To remove, must use the same priority as the one that was set in the add_action.


2

You don't need a plugin, if your images names really match with product SKUs and you use media uploader to upload the file, you can use a single function hooked in add_attachment and you are done. Once it require some work, I'd avoid to upload all the hundreds of images in one "session", probably you can upload sets of 25/50 images per time with no ...


1

I'll try and answer this for you based on the limited information you've provided... When using woocommerce, you also need to define the various image sizes for your products in the dashboard at Woocommerce > Settings > Product Image Sizes Whatever size you choose should match the sizes in your Media Library settings, but you've already said that these are ...


1

Your page seems to be currently using gravatars for comments, which is typical WP mechanics. Users with gravatar accounts will have their gravatars show up. WordPress doesn't natively provide "local" (specific to the site) avatars. You will need to use a third party plugin/solution if you want that.


1

You can post the terms by using wp_get_object_terms $terms = wp_get_object_terms($post->ID, 'departments'); if(!empty($terms)){ foreach($terms as $term){ $exampleName = $term->name; $exampleSlugs[] = $term->slug; } } Alternatively you can try to first ensure that the right taxonomy is being used: $taxonomies = get_taxonomies(); ...


1

I ended fixing this myself! After a lot of googling, I was lead to look in my wordpress uploads folder to see if Thumbnails were even being generated at all. Turns out they were not being generated! So why? For some reason my php_gd file was disabled in my php.ini file. I uncommented it, ran a regenerate thumbnails plugin in wordpress and viola! It all works ...


1

Not tested but should work: Add the following code to it the top of your header.php, after the < body > tag: <?php if(is_shop() || is_product_category() || is_product_tag() || is_product() || is_cart() ) { echo 'Maintenance Mode'; } ?> I am using the woocommerce conditional tags to check if you're on one of the pages, if we are then it displays ...


1

I imagine it should be possible by using woocommerce specific conditional tags, like is_woocommerce() and is_checkout(), to target the woocommerce pages. And by replacing the_content() via the_content filter. That's just a quick draft of an approach, see @mattroyal's answer for an outlined solution.


1

The shopping cart is a main structure of the WooCommerce checkout process and cannot be completely disabled. As there is no exact solution, the best way to do what you want, in my opinion, is go to WooCommerce Settings -> Checkout and remove the selected page for the cart. This way, there will be no front-end for the cart whatsoever, although selected ...


1

I had the same issue in a client site which turned out to be a php POST variable limit (1000) which is an attempt for PHP to solve some security issues. This can be easily changed via the php.ini config file ex: max_input_vars = 5000 you should also note the max_input_nesting_level But we ended up using a grouped products instead of variations.


1

There is another way: You can assign the "Shop" page as default home page. Now all the products will displayed to the home page. I mean index.php.


1

If you're post type is called 'product' then if you remove the code that registers your post type, and activate, say WooCommerce, the plugin should recognize the posts. You would need to configure some of the meta fields, however. Following up on your comment, WooCommerce registers the product post type with the following pertinent code: if ( ...



Only top voted, non community-wiki answers of a minimum length are eligible