Questions tagged [woocommerce-offtopic]

OFF TOPIC. PLEASE CLOSE THIS QUESTION. Questions *specific* for this e-commerce plugin have their own forum at https://wordpress.org/support/plugin/woocommerce. Click the "Learn More" link below for useful links such as Support and Developer Docs.

Filter by
Sorted by
Tagged with
40 votes
1 answer
102k 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', '...
37 votes
2 answers
117k 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 ...
  • 965
29 votes
1 answer
71k 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 ...
  • 431
25 votes
3 answers
39k views

List of JS events in the WooCommerce frontend

Where could I find an exhaustive list of javascript events defined by WooCommerce. ( Events like "woocommerce_variation_has_changed" )
  • 560
25 votes
6 answers
151k 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 = ...
  • 425
23 votes
10 answers
88k 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 ...
  • 625
23 votes
5 answers
74k 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 ...
  • 341
21 votes
5 answers
84k 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 ...
  • 349
18 votes
3 answers
51k 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, ...
  • 339
18 votes
3 answers
106k 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 ...
17 votes
1 answer
149k 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','...
17 votes
1 answer
76k 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 ...
  • 291
16 votes
2 answers
88k 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' => __('...
  • 335
16 votes
3 answers
191k 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 ...
  • 163
16 votes
2 answers
34k 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 ...
15 votes
1 answer
45k 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 ...
15 votes
4 answers
125k 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 ...
14 votes
1 answer
93k 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 ...
  • 1,121
13 votes
6 answers
26k 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 ...
  • 479
13 votes
2 answers
23k 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( '...
12 votes
3 answers
35k 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
1 answer
32k 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.
12 votes
3 answers
24k 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 ...
12 votes
2 answers
57k 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.
  • 320
11 votes
3 answers
43k 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 ...
  • 309
10 votes
3 answers
35k 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( ...
  • 389
10 votes
3 answers
53k 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.
10 votes
1 answer
84k 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() { $...
  • 101
9 votes
3 answers
34k views

Getting the gallery images from products in woocommerce?

Looking for a code which could potentially help me get the list of gallery images present in product in woocommerce. Need them so i can use them in a custom single page design for woocommerce product ...
9 votes
2 answers
58k 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 ...
9 votes
3 answers
30k 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 ...
  • 217
9 votes
2 answers
78k 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['...
  • 655
9 votes
1 answer
23k 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, ...
  • 163
9 votes
1 answer
64k 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, ...
  • 611
9 votes
4 answers
30k 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 ...
  • 91
8 votes
3 answers
33k views

Get url of product's images (woocommerce)

What happen when a post (product) didnt have a guid,because it has the same image with another product ? For example: Query1: select guid from wp_posts where post_type='attachment' and ...
8 votes
2 answers
4k 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 ...
  • 359
8 votes
1 answer
47k 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.
8 votes
2 answers
4k 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 ...
  • 145
7 votes
4 answers
94k 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 ...
  • 820
7 votes
3 answers
6k views

WooCommerce: Webhook disabled on its own

I'm developing an order management system that hooks into WooCommerce but the Webhook behaves irregularly. The Webhook gets disabled on its own. I've investigated with the users - none of them have ...
  • 251
7 votes
5 answers
10k 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';...
  • 181
7 votes
2 answers
6k 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....
7 votes
1 answer
30k views

How to check if is in cart page? [closed]

I'm creating a plugin to disable Cart on WooCommerce (even I know already some plugin doing this), I already removed the button to access cart page. But how can I check if url is /cart? WordPress ...
  • 321
7 votes
1 answer
52k 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 ...
  • 75
7 votes
6 answers
38k 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 ...
7 votes
2 answers
18k 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' ); ?&...
  • 171
7 votes
2 answers
117k 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 ...
7 votes
1 answer
8k views

Correct function to get the user's latest Woocommerce Subscription?

I've a members' only subscription site, where the member can only have one active subscription, and I need to be able to get the status of the subscription. I've been through all the documentation ...
  • 1,061
7 votes
1 answer
45k 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 ...

1
2 3 4 5
79