All Questions

Tagged with
Filter by
Sorted by
Tagged with
138 votes
6 answers
424k 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,812
103 votes
9 answers
281k 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,687
79 votes
5 answers
186k 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,969
76 votes
9 answers
219k 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,887
73 votes
6 answers
246k 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,155
67 votes
4 answers
246k 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,887
62 votes
3 answers
75k 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
61 votes
7 answers
276k 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
59 votes
15 answers
212k 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
59 votes
4 answers
159k 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
59 votes
6 answers
290k 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
58 votes
9 answers
237k 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,474
56 votes
3 answers
196k 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
8 answers
69k 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,266
48 votes
8 answers
127k 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,726
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,299
45 votes
10 answers
88k 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,604
41 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
39 votes
3 answers
70k 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
11 answers
148k 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
15 answers
56k 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
4 answers
79k 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,976
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,886
36 votes
1 answer
109k 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
100k 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
82k 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
12 answers
139k 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.3k
33 votes
3 answers
131k 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
84k 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
32 votes
13 answers
93k 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,145
32 votes
9 answers
107k 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
31 votes
5 answers
91k 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
31 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,617
31 votes
5 answers
63k 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
30 votes
6 answers
162k views

How can I get the order ID in WooCommerce?

How do I retrieve the order ID in WooCommerce?
Kourosh's user avatar
  • 917
30 votes
6 answers
127k 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,031
30 votes
3 answers
61k 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
79k 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
1 answer
68k 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
75k 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
  • 323
28 votes
11 answers
42k 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
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
28 votes
2 answers
114k views

How to filter WooCommerce products by custom attribute

I'm trying to filter WooCommerce product archive by custom attributes. For example, there are 5 products with attribute "color" containing "red", and another 3 with attribute "color" containing "blue"...
user avatar
27 votes
4 answers
33k views

Create an order programmatically with line items in Woocommerce 3+

I needed to create a Woocommerce order programatically, however using the 'old' Woocommerce made this a very dirty procedure. I had to insert all kind of database records manually, using many ...
Mattijs's user avatar
  • 3,275
26 votes
3 answers
154k views

Get the product name in Woocommerce

I want to be able to display a product title by using PHP to echo the product name by the product ID (this is to be displayed within a Page, not the product page itself). I am using Wordpress and I ...
nsilva's user avatar
  • 5,194
26 votes
8 answers
93k views

Woocommerce get variation product price

Im trying to display the product variation price inside the variations dropdown. Im trying to change default behavior where price is displayed inside a div when you choose a variation on the dropdown. ...
chifliiiii's user avatar
  • 2,231
26 votes
3 answers
83k views

Get product permalink by product name in Woocommerce

I am trying to get Woocommerce product permalink by given product name. I know I can get permalink by given product ID like this: $url = get_permalink( $product_id ); But I can not find any code to ...
user3868840's user avatar
26 votes
1 answer
34k views

Add columns to admin orders list in WooCommerce

I am using WooCommerce plugin for one of my ecommerce WordPress websites. I want to add some columns to my order listing page in the WooCommerce admin area. I am not able to find out where to add that....
Upendra Sharma's user avatar
26 votes
1 answer
38k views

Wordpress. Woocommerce. Action hook BEFORE adding to cart

What i need to do: I want to run some checks on a product before being added to the cart. More exactly: I want to compare the product i am about to add to the cart, with the ones already added, to see ...
Sergio's user avatar
  • 361

1
2 3 4 5
544