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
106k 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', '...
Hossein Hashemi's user avatar
39 votes
4 answers
59k 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" )
ZecKa's user avatar
  • 738
38 votes
2 answers
122k 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 ...
Larry B's user avatar
  • 985
28 votes
6 answers
165k 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 = ...
Malloc's user avatar
  • 463
24 votes
5 answers
75k 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 ...
G-Olly's user avatar
  • 351
19 votes
3 answers
114k 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 ...
Lucky Luke's user avatar
13 votes
2 answers
24k 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( '...
Aparna Mathew's user avatar
12 votes
2 answers
61k 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.
Iftieaq's user avatar
  • 320
9 votes
1 answer
26k 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, ...
Vucko's user avatar
  • 163
8 votes
1 answer
55k 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 ...
OT AMD's user avatar
  • 85
7 votes
2 answers
19k 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 ...
Peter Ingersoll's user avatar
5 votes
3 answers
11k 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 ...
user1752759's user avatar
3 votes
1 answer
1k 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 ...
smashingtuck's user avatar
1 vote
4 answers
5k views

product-attribute-slug-is-too-long-28-characters-max

Google did not fix my problem so.. Anyone here know how to increase the character limit for woocommerce product attribute slug, default it has a limit of 28 characters (max 32 in database) i need max ...
thijs thijs's user avatar
1 vote
1 answer
3k 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 ...
Anake.me's user avatar
  • 246
1 vote
1 answer
4k views

pagination in woocommerce order history page

Please help me to add pagination in my order history page. Pagination should work like WooCommerce products page. Here is my code: <?php $customer_orders = get_posts( apply_filters( '...
priya's user avatar
  • 21
1 vote
1 answer
6k views

Add a custom button with custom link after add to cart for every product

Let's say I need to add a custom button so visitors can visit the product's external site. That way they can visit the product's site. What I want to achieve is as follows: Add a custom button after ...
Gabriel's user avatar
  • 13
0 votes
1 answer
1k views

How to add Woocomrce cart page shipping calculator to my country state list

Im beginner for the word press , I don't know if the issue is because of the . The problem is that the "calculate shipping" option on my cart page doesn't allow users to select my country / state ...
core114's user avatar
  • 115
0 votes
1 answer
2k 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 ...
Jason Is My Name's user avatar
29 votes
1 answer
76k 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 ...
Nazeem's user avatar
  • 431
24 votes
10 answers
92k 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 ...
steamfunk's user avatar
  • 635
18 votes
3 answers
52k 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, ...
miles's user avatar
  • 339
16 votes
3 answers
192k 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 ...
Van Tong's user avatar
  • 163
14 votes
1 answer
95k 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 ...
JacobTheDev's user avatar
  • 1,201
13 votes
3 answers
36k 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 ...
Alessandro's user avatar
12 votes
3 answers
27k 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 ...
user3210369's user avatar
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 ...
Matt's user avatar
  • 309
11 votes
2 answers
69k 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 ...
Dhruvang Gajjar's user avatar
10 votes
2 answers
82k 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['...
Exclutips's user avatar
  • 685
9 votes
1 answer
66k 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, ...
eljefejb's user avatar
  • 621
8 votes
2 answers
120k 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 ...
user3751508's user avatar
7 votes
6 answers
40k 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 ...
user7432810's user avatar
7 votes
1 answer
19k 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 ...
user3344329's user avatar
7 votes
2 answers
5k 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 ...
Shoebox's user avatar
  • 334
6 votes
3 answers
6k 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 ...
chas ant's user avatar
5 votes
3 answers
23k 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 ,...
Samir salem's user avatar
5 votes
1 answer
19k 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 ...
Punct Ulica's user avatar
5 votes
1 answer
1k views

Slow Loading Attribute Select - WooCommerce Backend

At the moment we have a lot of product attribute terms, one attribute probably has around 20,000 terms inside it. When editing a product and clicking into the field for the attribute we get a freeze ...
KiwisTasteGood's user avatar
5 votes
0 answers
8k 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....
wpdd's user avatar
  • 313
4 votes
1 answer
32k 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 ...
clestcruz's user avatar
  • 201
4 votes
1 answer
8k 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 ...
armadadrive's user avatar
4 votes
3 answers
8k 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 ...
Desi's user avatar
  • 1,199
3 votes
2 answers
3k views

Is removing orphaned wp_postmeta records safe?

I am using woocommerce as a shopping cart on a wordpress site. Products and Product Variations are each stored as records in the wp_posts table. Each of these Variations have aprox. 15-20 associated ...
logicbird's user avatar
  • 131
3 votes
1 answer
52k 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://...
bonjourimcam's user avatar
3 votes
1 answer
2k 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 ...
BillyMedia's user avatar
3 votes
0 answers
27k views

How to get Woocommerce Variation ID? [closed]

I am trying to create some additional functionality on my Woocommerce backend where I add a custom field to the variations section of backend of Woocommerce. However I cannot for the life of me ...
Derek's user avatar
  • 373
3 votes
1 answer
24k 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( '/' ) ); ?&...
Padmanathan J's user avatar
3 votes
2 answers
19k 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')....
Patrick's user avatar
  • 295
3 votes
3 answers
13k 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 : ...
Irwan's user avatar
  • 191
3 votes
1 answer
6k views

How to execute a javascript function just before saving a woocommerce post or a post?

I am working on this project and I am trying to execute a jquery or javascript just before saving the post, I have tried the following: function do_something_with_a_post($id) { <script>alert(...
MariaZ's user avatar
  • 133