Questions tagged [woocommerce]

WooCommerce: a WordPress plugin. For how-to-use questions, ask their support team. It's mostly open source. On-topic questions: programming which changes or extends WooCommerce behavior. Questions about 3rd party plugins should be asked directly to the plugin support.

Filter by
Sorted by
Tagged with
139 votes
7 answers
431k views

How to get WooCommerce order details

In WooCommerce from the following line code: $order = new WC_Order( $order_id ); How can I get WooCommerce order details from the order id?
Faisal Ijaz's user avatar
  • 1,822
103 votes
9 answers
284k views

Get custom product attributes in Woocommerce

In Woocommerce, I am trying to get product custom attribute values but I fail miserably and I don't get anything. So I tried: global $woocommerce, $post, $product; $res = get_post_meta($product->...
ShintoTuna's user avatar
  • 3,707
79 votes
5 answers
188k views

WooCommerce: Finding the products in database

I'm creating a website using WooCommerce and I want to restrict the available products to users depending on the postcode that they enter in the search form on my home page. To be able to achieve ...
T.Doe's user avatar
  • 1,989
77 votes
9 answers
221k views

Get WooCommerce product categories from WordPress

I am trying to get the product categories from WooCommerce through a function in my WordPress theme function get_me_list_of($atts, $content = null) { $args = array( 'post_type' =&...
Tester's user avatar
  • 2,917
73 votes
7 answers
249k views

Get cart item name, quantity all details woocommerce

I am trying to send the woocommerce cart items to third party shipping tool. I need the item name, quantity and individual price to be sent to the third party. How can this be achieved? $items = $...
Philomath's user avatar
  • 1,165
69 votes
4 answers
249k views

Woocommerce get products

I used the following code to get the list of product categories form WooCommerce in my WordPress website: <?php $taxonomy = 'product_cat'; $orderby = 'name'; $show_count = 0; ...
Tester's user avatar
  • 2,917
63 votes
3 answers
76k views

WooCommerce - Remove downloads from menu in my account page

I would like to remove downloads menu from my account page. How can I do this? Is it any hook to remove a specific item from the menu? Thanks.
techiva.blogspot.com's user avatar
62 votes
7 answers
280k views

Woocommerce, get current product id

I'm currently working on a WooCommerce theme and attempting to add a sidebar to the product detail page. I've been able to get the sidebar added (specifically, this one: http://woocommerce.wp-a2z.org/...
shparkison's user avatar
61 votes
15 answers
215k views

How can I get customer details from an order in WooCommerce?

I have a function that does this: $order = new WC_Order($order_id); $customer = new WC_Customer($order_id); How can I get customer details from this? I have tried everything in the documentation, but ...
Alfonso Embid-Desmet's user avatar
60 votes
6 answers
293k views

WooCommerce - get category for product page

For my WC product pages, I need to add a class to the body tag so that I can perform some custom styling. Here's the function I'm creating for this... function my_add_woo_cat_class($classes) { $...
ban-geoengineering's user avatar
59 votes
4 answers
160k views

WooCommerce return product object by id

I am creating a custom theme for woocommerce and I need to be able to create a mini product display. I am having problems finding documentation on the woocommerce api. I have a comma delimited list of ...
STEAMworks Learning Center's user avatar
58 votes
9 answers
241k views

How to get featured image of a product in woocommerce

Please tell me where I am going wrong . Product featured image is not showing up. $args = array( 'post_type' => 'product', 'posts_per_page' => 80, 'product_cat' => 'profiler', 'orderby' =&...
Amar Singh's user avatar
  • 5,484
56 votes
3 answers
197k views

How to display Woocommerce product price by ID number on a custom page?

I'm trying to display a price of a product in Woocommerce, on a custom page. There is a short code for that, but it gives product price and also adds an "Add to cart button", I don't want the button, ...
MosesTheTool's user avatar
50 votes
3 answers
82k views

WooCommerce payment complete hook

After a long search, I found this post: WooCommerce hook for "after payment complete" actions which talks about creating web hooks in WooCommerce to notify a script to do...something......
Aaron Trumm's user avatar
50 votes
8 answers
70k views

WooCommerce products showing “Out of stock” message when not actually out of stock

Having an issue with a client website where products are randomly displaying "This product is currently out of stock and unavailable." The thing is that we don't have inventory tracking turned on,...
Ian's user avatar
  • 3,296
48 votes
8 answers
129k views

woocommerce get_woocommerce_currency_symbol()

I am developing an extension for woocommerce WordPress plugin. I would like to display the currency symbol outside of the loop in a custom function I have the following: function my_function( ) { ...
danyo's user avatar
  • 5,756
48 votes
3 answers
61k views

WooCommerce hook for "after payment complete" actions

I'm using WooCommerce and Wordpress. I have a custom license key generator, and I'd like it to generate a license key when someone successfully purchases my plugin through WooCommerce. It seems ...
Pete's user avatar
  • 7,389
45 votes
10 answers
89k views

WooCommerce: Add product to cart with price override?

$replace_order = new WC_Cart(); $replace_order->empty_cart( true ); $replace_order->add_to_cart( "256", "1"); The above code add product 256 to the Cart 1 time. But the issue I'm having is that ...
dcolumbus's user avatar
  • 9,634
42 votes
5 answers
39k views

WooCommerce: Auto complete paid orders

Normally wooCommerce should autocomplete orders for virtual products. But it doesn't and this is a real problem, even a BUG like. So at this point you can find somme helpful things(but not really ...
LoicTheAztec's user avatar
40 votes
3 answers
71k views

Apply a coupon programmatically in Woocommerce

In Woocommerce I'm trying to find a way to apply a 10% discount to an entire customer's order if the weight in the cart is over 100 lbs. I'm partway to achieving this. For the next step, I'm looking ...
msargenttrue's user avatar
38 votes
13 answers
122k views

How to disable the quantity field in the product detail page in woocommerce?

I need to hide the "quantity" field (where one enters the quantity before adding to cart) in Woocommerce on the product detail page, and only show the "add-to-cart"-button, which would then put the ...
user2051753's user avatar
38 votes
15 answers
58k views

WooCommerce - woocommerce_rest_cannot_view - Status 401

I have generated a consumer key and consumer secret. The website has SSL installed. I have also installed plugins required for JSON and REST services. This is how the url looks like: https://<url&...
Ram's user avatar
  • 483
38 votes
11 answers
150k views

How to display Woocommerce Category image?

I use this code in PHP: $idcat = 147; $thumbnail_id = get_woocommerce_term_meta( $idcat, 'thumbnail_id', true ); $image = wp_get_attachment_url( $thumbnail_id ); echo '<img src="'.$image.'" alt="" ...
MrRoman's user avatar
  • 793
38 votes
4 answers
80k views

Programmatically creating new order in Woocommerce

I am having the hardest time programmatically creating an order in WooCommerce. I am using the code below and is DOES create an order BUT I cannot get customer information OR product line items added ...
Joe Conlin's user avatar
  • 5,984
37 votes
1 answer
70k views

How to get Woocommerce Product Gallery image URLs? [closed]

I am developing a wordpress woo commerce shopping site and added some products. i want to get the product gallery image urls of each products. how can I get the URLs of images?
Jishad's user avatar
  • 2,926
36 votes
5 answers
94k views

Woocommerce - how to tell if product post has variations or not

I am trying to edit the short-description template to be different on variable (single) product pages than on simple products. the code in that page is here: global $post; if ( ! $post->...
Stephen's user avatar
  • 8,048
36 votes
1 answer
110k views

WooCommerce hooks and overriding templates

I have started to learn how to create templates with WooCommerce and I had faced with a little problem. For instance, in the php file content-single-product.php of Woocommerce plugin I have strings ...
Dmitry Shulga's user avatar
34 votes
4 answers
102k views

Add extra meta for orders in Woocommerce

I'm creating a custom plugin for my website. In some part of this plugin I need to store extra meta in wp_postmeta for each orders. I added this in my plugin's class: add_action ('...
Mo Saeedi's user avatar
  • 575
34 votes
3 answers
83k views

Getting order data after successful checkout hook

In WooCommerce, I would like to send a request to an API once the customer has successfully checked out. Its basically a website where the client is selling online courses (Like udemy). When the ...
Syed Haris Ali Ghaznavi's user avatar
34 votes
2 answers
41k views

WooCommerce - where can I edit HTML generated by hooks?

I'm new to WooCommerce. Anyhow, I want to create my own theme, so I followed the guidelines and copied accross the core template files to /mywordpresstheme/woocommerce/. That all works great and I'm ...
Michael Giovanni Pumo's user avatar
33 votes
13 answers
141k views

Get woocommerce carts total amount

I am trying to apply a discount to a carts total price, but I can only do it to the item base price and not the over all price. I Googled and came across this post in the wordpress stackoverflow: $...
Howli's user avatar
  • 12.4k
33 votes
3 answers
134k views

Woocommerce - Getting the order item price and quantity.

Using Woocommerce 2.6.8 , I can't get the Order Item Data information as described in the docs and here on SO. All I want is to get the Line Item price and Quantity, which should be as simple as: $...
robobobobo's user avatar
33 votes
5 answers
85k views

where is a woocommerce order placed in wordpress database

Where do order and everything in it is stored in the database after it is placed from a WordPress woo-commerce website? To be more precise, how can I get my shipping address without using woocommerce ...
MAK's user avatar
  • 331
33 votes
1 answer
1k views

Having trouble working with SelectWoo instances of Select2 within WooCommerce

I am using Select2 within WooCommerce in some of my own custom areas and I am targeting it with some code to add and removes certain classes and it's working fine except for the SelectWoo instances ...
Brett's user avatar
  • 19.7k
32 votes
13 answers
94k views

Create programmatically a WooCommerce product variation with new attribute values

I have created a variable product ("parent" product) in WooCommerce version 3+. From a WordPress plugin, I would like to programmatically create the product variations ("children" ...
Cedric's user avatar
  • 5,195
32 votes
9 answers
109k views

Woocommerce add to cart button redirect to checkout

I created an ecommerce using the plugin woocommerce. I am selling only a subscription so the "/cart/" page is useless. I'm trying to get rid of it so that when my customer click on "Add to cart" ...
Michael Villeneuve's user avatar
32 votes
3 answers
37k views

Override WooCommerce Frontend Javascript

Can someone guide me as to what is the proper method of overriding WooCommerce core Javascript files, specifically frontend files. I have not found any documentation on this and looking at the code, ...
Sebastien's user avatar
  • 2,627
32 votes
5 answers
64k views

Override Plugin Function in WordPress

I have a Plugin installed on my WordPress site. I'd like to override a function within the Plugin. Do I override this in my theme's functions.php and if so, how do I do this? Here's the original ...
michaelmcgurk's user avatar
31 votes
5 answers
92k views

woocommerce variations

I am creating a woocommerce theme and I have product variations i.e. size which is displayed on product details page but problem is that I want to get all variations in my custom php page by using ...
Sachin Magar's user avatar
30 votes
6 answers
165k views

How can I get the order ID in WooCommerce?

How do I retrieve the order ID in WooCommerce?
Kourosh's user avatar
  • 945
30 votes
5 answers
55k views

WooCommerce: trigger event after change of variation

We use Woocommerce to sell colorboxes. Mostly the variable-product option is chosen. We added a modal dialog with a color palette, where the customer can chose a color from. This is next to the common ...
MJay's user avatar
  • 497
30 votes
6 answers
128k views

How to modify WooCommerce cart, checkout pages (main theme portion)

I have been researching and tweaking away at my custom Wordpress theme and overridden WooCommerce templates with now WooCommerce installed to rectify a bunch of small formatting issues that occur on ...
Michael K's user avatar
  • 1,021
30 votes
3 answers
62k views

How to check payment method on a WooCommerce order by id?

I want to make some changes if the chosen payment method is COD. On existing WC_Order i have used ($order->payment_method_title == 'Cash On Delivery' ? ... : ... ); to retrieve the title. But i ...
belfort1's user avatar
  • 887
29 votes
2 answers
80k views

Get Order items and WC_Order_Item_Product in WooCommerce 3

Reading up the changes in WooCommerce 3.0, it seems that is not possible to anymore properties from order items directly, so I would assume that the following code needs to be changed, since it is ...
Solomon Closson's user avatar
29 votes
8 answers
84k views

How to clear a Woocommerce cart

I am wondering how you can clear the contents of your cart on page load using woocommerce. I came accross how to add a clear cart button using by adding this in to functions.php add_action( 'init', '...
user1370288's user avatar
29 votes
1 answer
69k views

Woocommerce - Get SKU in product single page

I want go get the SKU in my product single pages in Woocommerce. I tried <?php get_sku(); ?> which is a featured function according to the Woocommerce docs (http://docs.woothemes.com/wc-apidocs/...
carl_mace's user avatar
  • 293
29 votes
4 answers
78k views

Check if string contains any letter (Javascript/jquery)

How can i check if a string contains any letter in javascript? Im currently using this to check if string contains any numbers: jQuery(function($){ $('body').on('blur change', '#...
haveman's user avatar
  • 333
28 votes
11 answers
43k views

Show Out of stock products at the end in Woocommerce [closed]

Is it possible to show out of stock products at the end of a category or page in wordpress? So the customer first see the products that are available and after that the products that are out of ...
RaGu's user avatar
  • 723
28 votes
4 answers
101k views

Woocommerce location of checkout template

I'm trying to edit the checkout page, but can't find the template. What's the location inside plugin, of the file that has checkout fields?
jOpacic's user avatar
  • 9,463
28 votes
3 answers
52k views

WooCommerce: Add input field to every item in cart

I've been trying to add a single text input field to every item in the cart and submit that user input to product's meta info. It's been 2 days and I haven't succeeded yet. My objective is to: Take ...
Nix's user avatar
  • 500

1
2 3 4 5
661