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', '...
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.
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 ...
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 = ...
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 ...
3
votes
1answer
362 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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
3
votes
4answers
27k 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 ...
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 ...
3
votes
1answer
14k 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( '/' ) ); ?&...
1
vote
2answers
2k 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 ...
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 ...
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['...
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, ...
3
votes
1answer
8k 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 ...
3
votes
1answer
557 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 ...
2
votes
1answer
2k views

Default woocommerce placeholder image

So, here is the woocommerce setting that I have. I have three categories: A, B and C. From the backend, I gave category images to each categories. Now, let say I post a product in the category A ...
2
votes
2answers
6k 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 : ...
1
vote
1answer
2k views

woocommerce change currency per category [closed]

I am trying to display a different currency on a specific category within my Woocommerce store. Specifically, this category is full of items that can only be purchased through myCred points. The rest ...
0
votes
1answer
241 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 ...
0
votes
1answer
874 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 ...
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 ...
4
votes
0answers
2k 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....
2
votes
1answer
13k 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 ...
1
vote
1answer
3k views

Hide Price on one specific Woocommerce Single Product page [closed]

I need to hide the price on 1 specific Woocommerce Single Product page. I have tried a couple different code snippets I found but I am doing something wrong and nothing so far has worked. Can anyone ...
1
vote
3answers
11k views

Use get_term_children to get the sub category of a parent category for the current post

In my WooCommerce theme I've created a root category: 'Brands' then for each product I've added it's brand as a sub category to the 'Brands' parent category. On the product page I want to display the ...
1
vote
1answer
264 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
674 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 ...
0
votes
1answer
19 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 ...
0
votes
2answers
5k views

How to automatically apply woocommerce product title to all product images alt tags?

Adding alt tag information to every product photo is a lot of work. We always just copy and paste our product title into the image alt tags. I figured since all the information is there; there must ...
0
votes
1answer
1k views

Adding “reply-to” in the email [closed]

So, I am trying to add "reply-to" in the order email using the billing_email Here is what I have so far but the code is not written well and I am not sure how to change it. Here is the original: ...
0
votes
1answer
373 views

Did I do it right? Deleting images after deleting product. Woocommerce

I create, update and delete products using Woocommerce RestAPI, specifically this method: $woocommerce->post('products/batch', $data); After this method connected images remain in the server and ...
-1
votes
1answer
2k views

WooCommerce - Customer Order History Pagination

I'm trying to implement pagination into WC's customer order history that can be seen on the "My Account" page using woo_pagination(). https://docs.woothemes.com/document/woo_pagination/ The template ...
4
votes
2answers
3k 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 ...
3
votes
1answer
7k views

Move payment options at checkout in WooCommerce [closed]

I'm using WooCommerce and i'm new to both Wordpress and this plugin. I have downloaded a free theme which I will configure, however I can't figure out how I can change the checkout template. What I ...
3
votes
0answers
20k 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 ...
2
votes
1answer
3k 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(...
2
votes
2answers
6k views

How does Wordpress redirect to WooCommerce shop page? [closed]

I'm creating a plugin for WooCommerce, it needs a parameter in the url of shop page like this http://domain/wp/shop/?param=value. It worked fine until I set the shop page as front page, when I access ...
2
votes
2answers
67 views

Query multiple post type and categories

I have a div and inside I wish display by random a post from category-a or a product from category-b. I'm looking for a query to do that. I tried this: <?php $args = array( '...
2
votes
0answers
89 views

Hide some items from Screen options in dashboard for products

I am trying to unset/hide some options in dashboard. I am trying it for products screen. Here is the screenshot Here is the code i tried to hide SKU /** Hide Dashboard widget by default via Screen ...
1
vote
2answers
3k views

WooCommerce duplicate sub categories and product slugs

I'm building a website that allows you to hire or buy a product. I've set up the following product categories in WooCommerce: Hire Buy Is it possible to have the same sub-category slug under each ...
1
vote
1answer
646 views

Change Meta Title seperator and remove on homepage

I'm trying to change the character which is used as a seperator in my page title. At present it is in the format Site Name - Page Title However I would like to change this hyphen to a pipe ...
1
vote
1answer
93 views

How to combine tax_query and date_query in Wordpress

I'm using the following query to extract all products which are not in the 'Service' product category and order them by a custom meta field '_vintage_age'. $q->set( 'tax_query', array(array( '...
1
vote
2answers
6k 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')....
1
vote
1answer
787 views

Automatically check the option “Enable stock management at product level” on product creation

We have a peculiar WooCommerce setup where each product is only sold once. So we set each product to have 1 stock on creation automatically. Using stock management feature in WooCommerce requires an ...