Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [woocommerce]

OFF TOPIC. Questions *specific* for this e-commerce plugin have their own forum at https://wordpress.org/support/plugin/woocommerce.

31
votes
2answers
77k views

Woocommerce - Add a product to cart programmatically via JS or PHP [closed]

I am using the Woocommerce plugin to facilitate a small e-commerce part of a site and need to add products to its cart via some call or function rather than using its own 'add-to-cart' buttons. By ...
23
votes
1answer
63k views

How to add product in woocommerce with php code [closed]

I want to add products with PHP code like below: $post_information = array( 'post_title' => 'new item shop', 'post_content' => 'this is new item shop', 'post_type' => 'post', '...
20
votes
1answer
43k views

( Woocommerce) How to get the user belonging to an order? [closed]

I am making a function which needs to be called after an order is completed within WooCommerce. For this I'm using the *'woocommerce_order_status_completed'* hook. I want to check if the order has a ...
16
votes
7answers
45k views

Display featured products through custom loop in woocommerce on template page

I would like to display 6 featured products from my woocommerce store on my home-page.php template. After some researched I found that the right way to do this was through a custom loop,( I do not ...
16
votes
4answers
38k views

How do I delete all UNUSED images from my uploads directory?

I am trying to clean out my uploads folders as they are now starting to take up too much room on my server. I have tried to use plugins to achieve this end such as DNUI and Cleanup Images but these ...
15
votes
3answers
46k views

Hide prices and checkout functionality in woocommerce

I know this question might be too broad, but I'm looking for a bit of direction. My client has a woocommerce store with 30-40 products. For whatever reason they do not want to sell online anymore, ...
14
votes
2answers
26k views

Woocommerce Add Variation Product to Cart from custom link [closed]

I am trying to add a variation product to my cart directly through a link. I am setting the variation_id with the query string. As far as I can tell I am sending the data the exact same way as the ...
12
votes
3answers
63k views

Get the product list of a given Category ID

I couldn't find the right way to get the list of all products for a given category ID (not category name). The code I am using to get the categories list is the following, it works fine: $args = ...
12
votes
1answer
61k views

Display All Products by Category with WooCommerce

With WooCommerce, I want to display all the categories in a store as headings, with all of their products listed below in an unordered list. Is this possible to do? I've seen a few things that'll let ...
11
votes
3answers
40k views

How do I get WooCommerce to automatically recreate pages? [closed]

I had to uninstall WooCommerce plugin (I deleted the tables it created as well) and now I reinstalled the plugin and I doesn't automatically recreate the WooCommerce Pages. Am I stuck having to ...
11
votes
2answers
26k views

Make WooCommerce pages accessible for logged in users only

I have a website using WordPress, and an e-commerce using WooCommerce. I would like my shop (and all its pages) to be seen by logged in users only. Via the User Access Manager plugin, I have denied ...
11
votes
3answers
150k views

How to Display Product specific to a category with WooCommerce Plugin? [closed]

I'm using plugin Woocommerce to do shop online. I have many categories for example shoes, clothes and so on. How can I display the products of specific category? I see such product loops of on the ...
10
votes
1answer
41k views

WooCommerce: change display order of product short description and price [closed]

re: https://modestmix.com/shop/benefit-teas/go-the-fuck-to-sleep/ I'd like to move the price "$4.99–$24.99" below the product short description "Seriously. Drink a cup of this..." Any ideas how to ...
9
votes
4answers
49k views

How to correctly add Javascript in functions.php

I would like to remove some ugly looking arrows that are standard on cart buttons in WooCommerce. To achieve this, I found a tip of adding the following code, which should remove the arrows when the ...
8
votes
2answers
62k views

WooCommerce: How to edit the get_price_html

I am trying to edit the price value for a single product. In single-product/price.php there is a template call to $product->get_price_html. How can I edit that function/method to change the way ...
8
votes
1answer
17k views

Product categories don't appear as option to build menu

I am trying to add my product categories as top level categories in the navigation bar on my site. Under the "categories" option in appearance > menus, the only thing that appears under categories ...
8
votes
2answers
24k views

Woocommerce hook after creating order? [closed]

I am looking for a hook which will be triggered after someone submit checkout form and order placed ( no matter he made the payment or not ) . I tried woocommerce_new_order But it's not working.
7
votes
4answers
10k views

How to check if a plugin (WooCommerce) is active?

I am trying to modify the head and foot of my WooCommerce pages. I have an if statement that is supposed to target the shop and cart of WooCommerce, but it isn't. If I modify the PHP after the if ...
7
votes
2answers
40k views

How to display custom field in woocommerce orders in admin panel?

currently i add a custom billing field in woocommerce by function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_phone_new'] = array( 'label' => __('...
7
votes
1answer
31k views

How do you access the Product Short Description in a WooCommerce email template? [closed]

I would like to output the Product Short Description beneath the product name inside the order items table inside WooCommerce emails. I think I know where to place code inside the email template file, ...
7
votes
2answers
8k views

How to create a custom order status in woocommerce!

I've tried the below code to create custom status. add_action( 'init', function() { $term = get_term_by( 'name', 'shipped', 'shop_order_status' ); if ( ! $term ) { wp_insert_term( '...
7
votes
3answers
4k views

How to remove action hook done in a plugin from functions.php in my theme?

Somewhere in the plugin class there is this hook : add_action( 'woocommerce_some_hook', array( $this, 'some_function') ); it adds something I don't want there. In my functions.php in my theme, I ...
7
votes
1answer
34k views

How to get Woocommerce order product info

I am trying to get all woocommerce orders and find info about the products in each order. I have seen many examples on here and elsewhere on the web and they all seem to say to do the same thing but ...
7
votes
1answer
9k views

How to add a new endpoint in woocommerce

Im using woocommerce for a website and where the client sells software. One of the options I have to add is request a license button on my account page. I already have the function that does this in ...
7
votes
1answer
670 views

Wordpress Multisite: Adding actions to only one site

I have Wordpress Multisite installed with WooCommerce network activated. I want to add an action to a hook in ONE of the sites that has WooCommerce installed, instead of all of them. For example, I ...
7
votes
1answer
22k views

WooCommerce - How to Add a Custom Field to Cart Items and Cart Totals [closed]

I am using WooCommerce plugin and have the following query: Within the single product page, I have a product where based on certain selections by the buyer, a shipping cost value is calculated, which ...
6
votes
2answers
42k views

How to get current product category ID in product archive page

If I am on a product archive page then how can I get current product category ID in product archive page. I am using this but no result: global $wp_query; $category_name = $wp_query->query_vars['...
6
votes
2answers
2k views

What is the different between an attachment in wp_posts and an attachment in wp_postmeta?

After the Woocommerce dummy products are imported, I notice that in the database, there are different records in different tables but point to THE SAME photo attachment. The question is why? What are ...
6
votes
2answers
12k views

How to trigger WooCommerce order complete email?

I want to be able to trigger the WooCommerce order complete email at a different stage in the WooCommerce checkout process. So I've disabled WooCommerce order complete email from the backend and am ...
6
votes
1answer
9k views

Can I use Woocommerce to take orders but not handle payment? [closed]

I would like to create an ecommerce website. In this website the customer will browse the product catalog, add the desired products to his cart, maybe create an account, and during the checkout phase,...
6
votes
0answers
4k views

WP/WooCommerce REST API cart/checkout/order [closed]

Since the WordPress Rest API is getting merged into core and WooCommerce extended their API as well I stared to wonder how it would be possible to build an entire eCommerce website with it. When you ...
5
votes
2answers
23k views

get woocommerce My account page link

I am trying to send an email to customer after purchased products and when customer click on the the link provided the email for rating the product it should redirect to customer's account/My account ...
5
votes
3answers
60k views

How to get WooCommerce Product Category Link by ID?

WooCommerce's product categories are a custom taxonomy called product_cat. In a function I'm writing, I'm using get_categories with the taxonomy parameter set to product_cat. Everything works fine and ...
5
votes
1answer
3k views

Woocommerce add extra field to variation product

I'm following this tutorial on how to add an extra field to my variation products. I just need to add an extra text field. The admin part works fine - the field is showing and saving/updating, ...
5
votes
3answers
6k views

Edit tag cloud widget number

By default, the WordPress tag cloud widget has a set amount of 45 tags to display. This can be seen in the wp-includes/category-template.php file. By default, the WooCommerce plugin which I have ...
5
votes
2answers
535 views

How to update user role without logout

I am working on a wordpress project with the following plugins : Woocommerce Woocommerce product vendors WP Job Manager Wp Job Manager products I am trying to upgrade the user role after adding a ...
5
votes
2answers
12k views

WooCommerce return 404 on category pages

I am trying to set up WooCommerce permalinks to get something like: example.com/shop/ => Shop page listing products example.com/shop/category-name/ => Category page listing products from a category ...
5
votes
2answers
21k views

How to show product SKU on product page

I'm making a website and it seems that product sku is hidden from product page. I have found how to add it to the catalog (shop) page but I need it to show inside the product page. So far, by ...
5
votes
1answer
51k views

Woocommerce registration page [closed]

So...I just found out that the shortcodes for the login and registration pages are now removed from Woocommerce.... I know the forms are inside "My account" page, but I need a link in the menu to ...
5
votes
3answers
20k views

Display Category Thumbnail and links in Woo commerce

I would like to display my categories with a thumbnail in woocommerce. I am able to list the child terms as a link but i would like to add additional content. I have added the code below in which I ...
5
votes
2answers
4k views

Woocommerce show cross sells on singe product page [closed]

I am trying to show cross sells on a single product page rather than in the cart: So far I've tried the following code: <?php do_action( 'woocommerce_after_single_product_summary_data_tabs' ); ?&...
5
votes
2answers
239 views

How to remove an action within a class with extends

In the WooCommerce plugin, the PayPal gateway has recently been updated to capture payment on status change TO either "Processing" or "Completed". We want to ONLY allow capture after order status has ...
4
votes
3answers
19k views

How to check if woocommerce is activated in theme

I'm creating a theme with woocommerce which has the following: <ul> <li> <?php if ( is_user_logged_in() ) { ?> <a href="<?php echo ...
4
votes
2answers
7k views

WP_Query: Exclude hidden products from WooCommerce product list

I hope this is not too specific to WooCommerce. I have a nifty shortcode that displays a list of all my products with SKUs. However, it also includes products that I have published but have set the ...
4
votes
3answers
4k views

Order by rating not works in wp_query

I need to sort my products by rating in a wp_query loop: this is my code: switch($ordering){ case 'default': $meta_key = ''; $order = 'asc'; $orderby = 'menu_order title';...
4
votes
2answers
73k views

WooCommerce: Change template for single product page

I know there is a possibility to change the structure/design of the product page by editing the file single-product-php - in a child-theme. The changes made of that file will affect all the product ...
4
votes
1answer
14k views

WooCommerce Variable Product Price not showing on single product page

I made custom attribute for variation other than size or colour, but when i apply as variation to this attribute its not showing on single page.
4
votes
1answer
6k views

add_filter to modify woocommerce_cart_item_name hyperlink

I would like to override the woocommerce_cart_item_name hyperlink in order to direct the user to my own page when they click on the name of the product in the cart. I do not want to modify the ...
4
votes
4answers
6k views

Get all products with a custom attribute

I want do a custom query to get all products with an especific attribute ("demo" in my case) The query what i want returns from this: a:5:{s:4:"demo"; a:6:{s:4:"name"; s:4:"DEMO"; s:5:"value";...
4
votes
1answer
5k views

How to change or add Woocommerce thank you page URL key content?

I have searched enough and I did not find an answer for this question but this may be a simple one. In analytics, I want to set up goals for purchase and we have only 5 products, so each product ...