Hot answers tagged woocommerce
2
To clean up a complete array use the helper function __return_empty_array() as callback:
add_filter( 'woocommerce_screen_ids', '__return_empty_array', );
Similar helpers for further usage are:
__return_true()
__return_false()
__return_zero()
__return_null()
2
Normally this should work with get_queried_object_id().
Anyway, as I don't know what Woo exactly does to the query, this can be as well wrong, as the API function references to the object that is currently queried. And this is the object from the last query. So you might also do the following:
Disclaimer: The below written function is not tested and you ...
2
The short description template is /templates/single-product/short-description.php :
<?php
/**
* Single product short description
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $post;
if ( ! $post->post_excerpt ) return;
?>
...
2
To get a list of all terms of taxonomy X whose posts are associated to terms from taxonomy Y too, we have to:
Get all term IDs for both taxonomies
Create a tax query to fetch all posts, because we don’t want to show empty term archives.
Format the result in a hierarchical list.
Let’s go!
Getting the term IDs is simple:
get_terms( $taxonomy_name, ...
2
Here's a hack you can use.
Update: As Andrew Bartel mentioned below. It's best to copy the template files into your theme so that they override the default woo commerce template files.
In your woocommerce plugin folder, look for a file called product-reviews.php
woocommerce/templates/single-product-reviews.php
Look for a line that says
<div ...
2
The following works for me for product archive pages (these include both the main shop page as well as archive pages for product categories, for example).
It will show the current cart contents in a thickbox. I chose to show this for this example just because that's the data that one gets back through Ajax after clicking the add-to-cart button, but you may ...
1
My friend Ewout just answered this question a couple months ago on stackoverflow. Add the following to your theme's functions.php file:
add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
global $woocommerce;
$checkout_url = $woocommerce->cart->get_checkout_url();
return $checkout_url;
}
Here's ...
1
I hate to offer an answer that isn't too much more than a link, but well the question itself is very weak and most importantly there's little incentive to build this yourself when it already exists as a plugin:
http://www.woothemes.com/products/woocommerce-subscriptions/
You could either create different products for each of the subscription plans, or now ...
1
Ok I seem to have got it working. I added this in the functions file...
//Reposition WooCommerce breadcrumb
function woocommerce_remove_breadcrumb(){
remove_action(
'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20);
}
add_action(
'woocommerce_before_main_content', 'woocommerce_remove_breadcrumb'
);
function ...
1
On the Product Edit page for the variable product, click on the "Variations" tab.
Once you setup variations for the Colour you can set a "Default selection" at the bottom: http://cld.wthms.co/7LIv
This will be the default option selected when a customer visits the page (if it is in stock).
Example: http://cld.wthms.co/YQFO
1
With Authorize.net AIM (http://www.woothemes.com/products/authorize-net-payment-gateway/) the "Sale Method" can be set to "Authorize Only" which will verify that funds are available on the customer's card, but not capture the funds. http://cld.wthms.co/afXJ
Then when the product ships the funds can be captured inside of the Authorize.net account dashboard. ...
1
You're querying two different taxonomies- in your wpbd query you reference product_cat. in the call to query_posts you reference the default category taxonomy via the cat argument.
as an aside, you should be using WP_Query instead of query_posts.
1
First, don't use query_posts. From the Codex:
query_posts() is the easiest, but not preferred or most efficient, way
to alter the main query that WordPress uses to display posts. It does
this by putting the main query to one side, and replacing it with a
new query. To clean up after a call to query_posts, make a call to
wp_reset_query(), and the ...
1
The shop page is actually an archive page for posts of type 'product'. Its template is in woocommerce/archive-product.php.
You need to use the pre_get_posts action to preprocess the query before the loop, conditional_tags to recognize that you are in the product archive page, and a taxonomy query to filter the product categories, which belong to the ...
1
you can get the order items of an order by
$order = new WC_Order( $order_id );
$items = $order->get_items();
then if you loop through them, you can get all the relevant data:
foreach ( $items as $item ) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
}
a good tip is to ...
1
Does anybody know if there any simpler ways to give users who purchase
certain products free shipping?
Actually, when creating a product you can just mark it as a Virtual product right within the product editor and that will exclude shipping completely for that item.
1
Woocommerce stores 'order' metakeys in the table wp_woocommerce_termmeta. The mechanism it uses is the same as 'menu_order' for posts.
Something like this should work:
$terms = get_terms('product_cat');
//sort $terms somehow
$i = -1;
foreach ($terms as $term) {
$i++;
update_woocommerce_term_meta( $term->id, 'order', $i);
}
The same procedure ...
Only top voted, non community-wiki answers of a minimum length are eligible
