Questions tagged [woocommerce]

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

Filter by
Sorted by
Tagged with
37
votes
1answer
86k 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', '...
34
votes
2answers
101k 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 ...
27
votes
1answer
58k 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 ...
23
votes
5answers
59k 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 ...
22
votes
9answers
73k 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 ...
19
votes
5answers
109k 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 = ...
18
votes
3answers
49k 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, ...
17
votes
1answer
67k views

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

I'd like to move the price "$4.99–$24.99" below the product short description "Seriously. Drink a cup of this..." NSFW Image Below ( Adult Language ) Any ideas how to do this? I already have a ...
15
votes
2answers
31k 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 ...
14
votes
3answers
176k 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 ...
14
votes
2answers
85k 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 ...
14
votes
2answers
69k 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' => __('...
13
votes
5answers
51k 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 ...
13
votes
1answer
82k 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 ...
13
votes
1answer
33k 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 ...
12
votes
3answers
32k 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 ...
12
votes
1answer
75k views

Get woocommerce product price by id [closed]

i make one shortcode for get product title, image and price. i am getting all title, link and image properly but not getting price. but problem is add_shortcode('product_data','...
12
votes
4answers
87k 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 ...
11
votes
3answers
42k 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 ...
10
votes
1answer
22k 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.
10
votes
2answers
18k 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 ...
9
votes
3answers
27k 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 get_permalink( ...
9
votes
5answers
19k 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 ...
9
votes
2answers
16k 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( '...
9
votes
2answers
41k 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.
8
votes
1answer
50k 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
3answers
23k views

Woocommerce override mini-cart.php not working [closed]

I am trying to override mini-cart.php which is template file located at woocommerce/cart/mini-cart.php. It should override behaviour of woocommerce widget cart but it isnt working. I can make any ...
7
votes
2answers
65k 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['...
7
votes
1answer
13k 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, ...
7
votes
2answers
3k 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 ...
7
votes
4answers
20k views

WooCommerce prices location in DB

I'm looking for the location of a product's prices according to the option which the user selects in the product price. For example, this WooCommerce shop has a select which prices change according to ...
7
votes
1answer
35k views

Retrieve Product category 'NAME' by product category ID - WooCommerce?

Can I retrieve woocommerce product category name by ID? Not thumbnail, not the URL, not the Sub-categories, just raw Category name.
7
votes
1answer
42k 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
43k views

Check IF is a “single product page” and Check the “role” for a Redirect

After much research on the net, I have not found a solution that works. Do you know how can I do that on woocommerce : I try that for the moment : function cm_redirect_users_by_role() { $...
7
votes
1answer
14k 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
1k 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
2answers
4k views

Creating Multiple wp_localize_script for Shortcode?

I have a shortcode that displays recent WooCommerce products in a carousel, however i would like the end user to be able to use the shortcode multiple times on the same page, currently when this ...
7
votes
1answer
24k 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 ...
7
votes
2answers
2k views

How to pass/get data to/from the WooCommerce data-product_variations object?

What is the best way to pass/get data to/from the data-product_variations attr form in Product Single pages. I am working on some interactions with the product gallery images and the product ...
6
votes
2answers
35k views

How to modify navigation menu of the “My Account” page in WooCommerce

I want to modify the WooCommerce "My Account" left side navigation menu. For that, I have made changes in the woocommerce/templates/myaccount/navigation.php. The problems with this approach are: I ...
6
votes
2answers
38k views

How to override WooCommerce template files?

I was trying to customize the shop page (adding widget area to the page). Is there any way or plugin to help me do so? I created a page-shop.php however no changes were seen.
6
votes
4answers
7k 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';...
6
votes
2answers
98k 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 ...
6
votes
1answer
31k views

how to override woocommerce specific loop or archive-product.php [closed]

so far while my woocommerce theme loop through all products in shop page i'm trying to customise and add few bootstrap classes to style it in a prober way since default styles generated causes layout ...
6
votes
5answers
25k views

Woocommerce: How to remove page-title at the home/shop page but not category pages

I have set the "shop" page as my front page and I want to remove the default woocommerce title from the home page of the site. I have emptied the title but I still get an empty tag like this on the ...
6
votes
1answer
3k views

Are there any hook or filter when refund is done through admin -woocommerce

I am using Woocommerce plugin for my custom product .and I am stuck with a situation . Does Woo commerce provide any hook or filter when refund is done through admin panel and refund will be manually....
6
votes
2answers
37k views

Display single product attribute value on Shop page (Woocommerce)

I am trying to display a single attribute ('size') value on shop page. I used the following code to show all values, tried to adapt to to show a single attribute, but with no success... Can you ...
6
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 ...
6
votes
3answers
27k 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 ...
6
votes
1answer
14k 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,...

1
2 3 4 5
80