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
88k 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
103k 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 ...
19
votes
5answers
112k 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 = ...
9
votes
2answers
43k 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
1answer
14k 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
8k 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 ...
14
votes
2answers
86k 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 ...
5
votes
2answers
13k 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 ...
0
votes
1answer
205 views

WP_Query | Help me create a search term with an 'OR' relation?

I have written a very elaborate script that will essentially allow the user to select from categories, tags and of course the search term. Then run these parameters through a WP_Query. I can ...
6
votes
1answer
33k 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 ...
2
votes
1answer
772 views

Fatal Error when installing woocommerce despite upgrading

I want to install woocommerce on my website and have selected a new theme to do so. I even upgraded from an old server to a new one running the latest version of php. However, I still get the same ...
1
vote
1answer
2k views

When Free shipping is available hide other shipping methods except Local pickup in WooCommerce [closed]

I currently have WooCommerce setup to allow free shipping on orders over a certain amount. However, I also have local pickup available and would like to allow BOTH if over a certain amount. I have the ...
14
votes
3answers
177k 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 ...
13
votes
1answer
83k 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 ...
18
votes
3answers
50k 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, ...
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 ...
5
votes
1answer
8k views

Woocommerce documentation | list of JS events

Where could I find an exhaustive list of javascript events defined by WooCommerce. ( Events like "woocommerce_variation_has_changed" )
23
votes
9answers
74k 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 ...
23
votes
5answers
61k 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 ...
9
votes
2answers
17k 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( '...
10
votes
2answers
19k 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
2answers
37k 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 ...
3
votes
4answers
31k views

Changing Woocommerce Product Description [closed]

I've been changing the way that the Single product page looks. I've moved a few things about by hooking into Woocommerce and also editing the css. Out of the box the single product page shows the ...
27
votes
1answer
59k 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 ...
8
votes
1answer
52k 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, ...
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 ...
5
votes
1answer
13k views

What is the code to get the download link for a product in WooCommerce?

I'm trying to add the direct download link of a product to a button, but I'm stuck. What I tried is this <a href="<?php echo $product->downloadable_files; ?>">Download</a> And ...
4
votes
3answers
18k views

how to use wc_create_order with subscription product

I want to create a new order programatically. This code works well with simple product, $product = get_product($product_id); $order = wc_create_order(); $order->add_product( $product ,...
3
votes
1answer
32k views

Hook and send Woocommerce data after click Place Order button

I'm finding the way to add a hook to my woo commerce check out page (http://localhost/checkout) I'm tend to send cart items and billing address, user information to another page such as http://...
3
votes
1answer
20k views

Create product category and keyword search form in woocommerce? [closed]

i want to build category and keyword based search form. so i got this following form <form role="search" method="get" id="searchform_special" action="<?php echo esc_url( home_url( '/' ) ); ?&...
2
votes
1answer
11k views

Permalinks for WooCommerce Categories and Subcategories

Setup Desired permalink structure (only these structures exist for products) Product 1: /shop/category/subcategory/product1/ Product 2: /shop/category/product2/ Woocommerce Product View Settings ...
1
vote
1answer
2k views

Add Dropdown menu using “add_filter => wp_nav_menu_items”

My project: Wordpress, Woocommerce, Bootstrap 4, bs4navwalker My problem: Custom dropdown item added by WP filter. I have one navbar, 3 differents menus inside (using bs4navwalker), a badge for the ...
1
vote
2answers
3k views

Hide a menu-item and its submenus and display a 'Log in' link if the user is logged out

I need, somehow, to enable that when you logout, that 'My Account' item is getting hidden from the navbar, and instead it displays a 'Log in' link. The item 'My Account' also have submenus with the ...
7
votes
2answers
67k 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['...
3
votes
2answers
14k views

Apply jquery script to only woocommerce product pages and categories

I have this script that automatically scrolls down to the primary content on page load. jQuery(document).ready(function($){ if ( $(window).width() < 768 || window.Touch) { $('html, body')....
3
votes
1answer
1k views

Reflect nested categories in appearance > menus

Anyone know why my categories stop being nested in the product categories widget within appearance > menus? They begin nested, but stop after Age 4 to 6. I have a set of woocommerce product ...
3
votes
3answers
9k views

Save Custom Fields for Variations Product

Currently I am using WooCommerce for WordPress and trying to add custom fields for Variations Product. After did some researches, I found some code and tried to modify it. This is my full code : ...
2
votes
1answer
1k views

How to solve suspected memory issue in custom WordPress loop?

I have written a plugin that adds a "Where did you hear about us?" question to the WooCommerce checkout page and shows the results (as a simple horizontal bar chart) in a wp-admin page. The plugin ...
0
votes
1answer
303 views

How to maintain wordpress site blogs in production and staging?

I work as a website admin in my company. We are selling digital products using WooCommerce. We wanted to have staging and production in order to avoid any site down. So in staging we use to create ...
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 ...
5
votes
1answer
20k views

How to get woocommerce inventory status [closed]

In a woocommerce theme, Im trying to show a warning when product is out of stock. Something like this: <?php if ('this_product_is_out_of_stock'): ?> <p>This product is out of stock. ...
4
votes
1answer
26k views

get product attributes for current product and store it in a variable

Been trying to figure out how I can get the product attributes of the current product and store it in a variable and put it in a class. I've managed to get the product attributes, unfortunately it ...
4
votes
0answers
5k views

single-product.php template not working for single products [closed]

single-product.php template not working for my Woo commerce single products and instead it is using single.php file of my theme. I do not have woocommerce.php file in my theme but still single-product....
3
votes
1answer
6k views

What's the difference between WC() and $woocommerce

I want to unset some WooCommerce session variables because on page load the hooks I'm using haven't fired which leaves previous session data populating the checkout shipping table. Within any ...
2
votes
1answer
3k views

How to get rid of the hover zoom in WooCommerce single products

I'm trying to get rid of the function where users can hover over the main product image and zoom into the product. I tried using this code, which has been confirmed by others to work, but nothing ...
1
vote
1answer
289 views

Use Hooks to Limit One Comment Per User Per Post - Hide Form if Already Commented

I know that the question of limiting each user to 1 comment per post has been asked a million times and I have read them all so please bear with me. I am trying to limit Woocommerce reviews per ...
1
vote
1answer
3k views

Show recent products first but “sold out last” in query

I am using WooCommerce and would would like to show the "out of stock" products last in the query on the archive page. How can I do that? Currently we are making the newest product show first with ...
1
vote
1answer
454 views

How do I edit pre_get_post for the category the user is currently in?

I've got a Woocommerce site that uses categories and products within those categories but how do I get my search form to only display results of products within the category the user currently is in. ...
1
vote
1answer
2k views

How to Acheive the custom woocommerce category template

currently My archive-product.php shows like this. https://khaleejdev.com/kds/newtornetto/product-category/multilingual-digital-marketing/ Inside this there are 15 products and 3 subcategories (each ...
1
vote
1answer
2k views

How does WooCommerce display a custom comment_type in Comment Admin?

There have been many threads and topics over the past few years about how to create a custom comment type. For the most part it's my understanding that it's possible (because WooCommerce does it) but ...