Questions tagged [woocommerce]

1

votes
2

answer
1.5k

Views

WooCommerce Show Payment Gateways for Logged In Customers Only

I am setting up an ecommerce site using Wordpress and WooCommerce. We are using the wordpress member accounts to track customer information, and we need a way for logged in members only to be able to choose to purchase their cart 'on credit', meaning no payment is required to place the order. Basica...
BWDesign
2

votes
1

answer
26

Views

WooCommerce filter tag by category

I'm using WooCommerce and Storefront to build a site. I have a catalog of several categories, presenting many products. To sort the products, I don't want to use sub-categories (too many categories, with too many sub-categories). Instead I would like to use tags. But I would need to sort and display...
NightCoffeeLover
0

votes
0

answer
2

Views

Linking Woocommerce Subscriptions and Account Funds plugins

I have purchased 2 plugins (Woocommerce Subscriptions and Account Funds) that state in their relevant docs that they are compatible with each other. I wish to make a Simple Subscription product that adds the product value as account funds when checked out and again each time the Simple Subscription...
Gracie
1

votes
2

answer
152

Views

Calculate shipping methods/rates within an existing order in WooCommerce

I am essentially trying to replicate functionality like on the cart page where a user can add their zip code and it calculates available shipping rates, but I'm trying to do it from the back-end from within an already-created order. I could not find a way to do it directly from WC_Order instance, so...
zen
0

votes
0

answer
5

Views

How to set complicated variable products with wordpress?

I am trying to make an e-commerce website with WooCommerce and Wordpress that is similar to the website Print Home. Where they have products like this: https://printhome.co.uk/products/standard-business-cards/ https://printhome.co.uk/materials/wallpaper/ As far as I have seen in WooCommerce for the...
user2898100
1

votes
3

answer
4.4k

Views

wordpress/woocommerce: Remove price if zero

I'm busy with a wordpress/woocommerce site and I'd like to hide the price of an item when it's zero on the product category/archive page. I've tried looking on the web and in the php files but couldn't find where I should add the if statement. My php knowledge is pretty limited. I was wondering i...
Iliass Assoued
1

votes
2

answer
3.1k

Views

Add Billing Address to Woocommerce Registration Page

I found a solution to this problem and added the code found here: Hide billing address from checkout page but keep the information under '2) Adding Billing fields in user registration My Account page' This successfully added the billing address to the registration form. The fields from the registrat...
Mark Reese
1

votes
1

answer
422

Views

Shipping calculated on cart items weight and cart amount

In a client WooCommerce web site, free shipping method is enabled for orders amount up to 250. I use the code below (from this answer), to hide other shipping rates when the order amount is over 250, except when there is heavy items in cart. add_filter( 'woocommerce_package_rates', 'conditionally_hi...
spy
1

votes
2

answer
3.5k

Views

Get chosen shipping method title by its Id in WooCommerce

In WooCommerce includes\class-express-checkout-gateway.php file I am getting shipping method Id by the following code: $chosen_shipping_methods = WC()->session->get('chosen_shipping_methods'); It gets flat_rate:1, but I need its title - Flat Rate. I have already tried all this answers and many more....
developersaumya
1

votes
1

answer
405

Views

How to query products by their categories woocommerce

Im building a quick order form/ order table in Woocommerce What I'm going for is something like this Main category one Subcategory product product Subcategory product product Main category two Subcategory product product Subcategory product product My question is how do I query products under their...
Tsea
1

votes
2

answer
54

Views

User redirect after login, depending on its role in WooCommerce

In Woocommerce, I have code that changes the role if the user buys a certain product. add_action( 'woocommerce_order_status_processing', 'change_role_on_purchase' ); function change_role_on_purchase( $order_id ) { $order = new WC_Order( $order_id ); $items = $order->get_items(); foreach ( $items as...
Dmitry
1

votes
0

answer
3

Views

woocommerce transactional emails: using g suite or mailgun? recommendations and experiences

I want to use SMTP for transactional emails in woocommerce. As I understand the sending limits for G Suite are: 130 mails per day (SMTP) Is this right? I used this reference link: https://support.google.com/a/answer/2956491#sendinglimitsforrelay (Review sending limits for the SMTP relay service) or...
mika2019
1

votes
2

answer
1.6k

Views

Woocommerce shop page product description

I added the following code to my functions.php file to add a short product description under the thumbnails on my shop page. add_action( 'woocommerce_after_shop_loop_item_title', 'lk_woocommerce_product_excerpt', 35, 2); if (!function_exists('lk_woocommerce_product_excerpt')) { function lk_woocomme...
primaltwins
0

votes
0

answer
9

Views

Woocommerce: hide products when user logged out

I've tried searching but I think this seems a real cornercase of WooCommerce. I have a certain product category that I only want to offer to logged in users. How would I implement that? A plugin or programmatic (code) option is fine.
John Smith
1

votes
1

answer
13

Views

Update user display name from custom checkout field in WooCommerce

In WooCommerce, at checkout, I am able to create or update all the user and billing information while placing an order. However, I want to set/update the user 'display name' (alias) as well. So based on 'Capture custom checkout field value in Woocommerce' answer code, I have added the following cod...
Roasty
0

votes
0

answer
5

Views

Woocommerce place order button script

I need to get the order id as a unique string type how do i do this? When an order is placed it is showing an order number e.g 2367 in admin when i use this code $order_id = str_pad($order_id, 4, '0', STR_PAD_LEFT); It shows as 0000. Also how do I do an on Click event for the place order button on...
Barker Antony
1

votes
1

answer
1.2k

Views

Hook in woocommerce on subscription expiration

How can I create an Hook in woocommerce (wordpress) to be able to trigger a function when a subscription expires? Something like this add_action('woocommerce_subscription_expired', 'my_function', 10, 1); function my_function($order_id) { echo 'yeahhhh'; } UPDATE I found in the developer doc the foll...
QGA
0

votes
0

answer
5

Views

Custom grid layout for woocommerce products

Does anyone has any idea on how to show woocommerce shop page like the attached image? Black squares are products. Thanks!
Gabriel Meisel
1

votes
2

answer
1k

Views

WooCommerce - get number of different products in cart

There is WC()->cart->get_cart_contents_count() to show the total number of products in the WooCommerce cart. But how do you get the number of different products? For example: 3 * product A 2 * product B WC()->cart->get_cart_contents_count() would return 5. But we want to get 2.
Michel
3

votes
1

answer
17

Views

Exclude a product category from Related products in WooCommerce

I am trying to exclude a product category (id: 78) from the related products section in WooCommerce. I have a custom query already in place which only shows related products from the child category. This is my code:
dwinnbrown
0

votes
0

answer
4

Views

Woocommerce how to get custom field value from function.php

Im tring to get custom field value via functions.php using this code: function discount_base_quantity(){ global $woocommerce; global $post; $product = $woocommerce->cart->get_cart(); foreach ($product as $key => $value) { $product_id = wc_get_product($value['data']->get_id()); $field = get_post_met...
BMARK AMIT
0

votes
0

answer
3

Views

Woocomerce display custom field in order email template

Hi I using solution provider here Show Woocommerce custom checkout field value in admin order making them editable. Works perfect. Question: is it possible to add my Custom field in (order email) template?
Deividas Krupstas
1

votes
1

answer
2.3k

Views

Meta box with a wysiwyg field displayed on Woocommerce single product custom tabs

Need to display a custom fields in the related products on a single product page. I would like to add a meta box to the Add New Product fields and display results on custom tab on single product page under reviews.I tried using code but nothing shows on the page. Adding extra product tab helps me...
Amit
1

votes
1

answer
2.8k

Views

Woocommerce - How to show Order details (my-account) on a separate page

Right now, in woocommerce the shortcode [woocommerce_my_account] displays the entire 'My Account' page with all the tabbed options. I only want to show the order details (found under the Orders tab) on a separate page. So, can I just use the woocommerce template orders.php (woocommerce/templates/m...
mesumosu
1

votes
1

answer
852

Views

Add new order status and send email notification woocommerce [duplicate]

This question already has an answer here: Add custom order status and send email on status change in Woocommerce 1 answer Display orders with a custom status for “all” in Woocommerce admin orders list 1 answer Add shipped status on order status change and when status changed to shipped email n...
Ansaf Ans
1

votes
2

answer
3.4k

Views

Customizing my-account addresses fields in Woocommerce 3

I would like to remove the form field billing_adress_2 within the template form-edit-addresses.php. To finish is it possible to reorder the form fields likes this: first_name - last_name email - phone company address_1 postcode city state This change I would like to apply it only on the page (t...
Dom
1

votes
2

answer
81

Views

Line break in php wordpress not working [duplicate]

This question already has an answer here: New lines (\r\n) are not working in email body 10 answers The following text is used to generate an email that is sent to a custommer after filling the woocommerce form. Im trying to add a line break in certain parts using \n This is not working. The email...
kevin seda
0

votes
0

answer
24

Views

Convert Raw JSON Text from getting the URL and make it an IMAGE

I am trying to connect to the external site and get the products there and copy them to another site by using its consumer and secret keys. I have the a URL Link that links from an External Site1 Now I get all the JSON Data (including sales, images, data etc.) by using PHP CURL Here is the Code: fun...
askCocoa
0

votes
0

answer
2

Views

Exclude upsells and related product from is_product() in woocommerce

I have the following function which should change the price display on archive page and of upsells and relateds products on single product page. But the product price within the woocommerce_single_product_summary shouldnt change. At the moment the if (is_product()) return $price_html is excluding up...
Krystian Manthey
1

votes
3

answer
5.5k

Views

Wordpress get all attributes and values

Actually I have custom attributes in product for after this create searches for these attributes , the case it´s I try show all attributes and values but no get finally For example actually I have the attribute called colors, in this attribute I have different values, red, green yellow, blue For s...
Robert
1

votes
1

answer
2k

Views

Refresh cart_fragments(mini-cart) by PHP or jQuery?

Im trying to update the mini-cart (cart_fragments) after/on an ajax event. It works like this. HTML Trigger: jQuery request: jQuery( document ).on('click', '.woomps-button', function() { var nr= jQuery(this).data('button-nr'); jQuery.ajax({ url : subpost.ajax_url, type : 'post', data : { action : 'w...
robped
1

votes
2

answer
9.4k

Views

Adding a hook to “Place order” button in woocommerce

When the user gets to the checkout, there is a button , the 'Place order' button at the bottom of the form. I have been trying to add a hook to this button in woocommerce, but I don't seem to find the correct one, I have tried woocommerce_checkout_place_order... but it doesnt do anything. function m...
MariaZ
1

votes
1

answer
530

Views

WooCommerce order-received endpoint and the order object

I am using the conditional is_wc_endpoint_url('order-received') in my header to check to see if the the 'page' is the Order Recieved end point, and if so I add some additional code to my Facebook Pixel code. However I would like to access the order object as well so I can get the total of the order...
Chris Hawkins
1

votes
1

answer
2.6k

Views

Echo Cart meta data in Woocommerce (Woocommerce-bookings)

I have a Hotel-bookings site which is made in Wordpress using following plugins: Woocommerce Version 2.4.12 WooCommerce-Bookings Version 1.9.3 Product-Add-ons Version 2.7.14 End Goal My end goal would be to show the Start & End Date of a booking on my Shopping Cart/Checkout-page & emails. Currently...
Christophvh
1

votes
1

answer
407

Views

Removing Purchase Note from admin email woocommerce

I have direct modified the abstract-wc-order.php in the includes folder (of my child theme) to remove the purchase_notefrom the admin emails. 'items' => $this->get_items(), 'show_download_links' => $this->is_download_permitted() && ! $args['sent_to_admin'], 'show_sku' => $ar...
Cecily
1

votes
1

answer
109

Views

WooCommerce Subscription - Notice translation is not working

WooCommerce notice is not getting translated even if I add Japanese ( ja ) msg in .po/.mo file [PoEdit] Complete checkout to resubscribe. if ( WC()->cart->get_cart_contents_count() != 0 ) { wc_add_notice( __( 'Complete checkout to resubscribe', 'woocommerce-subscriptions' ), 'success' ); } I went th...
mujuonly
1

votes
1

answer
2.4k

Views

Woocommerce create variable product multiple attributes programmatically

I am creating woocommerce variable product programmatically. Successfully created single attribute(size) but now i am trying to create another attribute (color). I have this attributes array from my form. Array ( [0] => size [1] => color ) and here is the code i tried : $args_t = array( 'orderby'...
Maha Dev
1

votes
1

answer
254

Views

Translating add to cart woocommerce

I am trying to translate add to cart button. I have 2 code snippets from woocommerce documentation here are they: FOR SINGLE PRODUCT - THIS ONE WORKS add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 + function woo_custom_cart_button_text() { retu...
Usce
1

votes
1

answer
1.1k

Views

WooCommerce REST API Premature Timeout

I'm using WooCommerce's 'REST API' (worst decision ever) in an attempt to bulk insert/edit products from an external feed. This is working great on my end, but there simply must be something WooCommerce is failing on itself and it's getting in the way of my own progress, because a certain (variable)...
Deji
1

votes
2

answer
964

Views

How can I add to the order meta from input boxes?

I'm creating a plugin for wordpress and woocommerce. In my plugin, I've inserted an input box above the checkout form using code using 'woocommerce_before_checkout_form'. On completion of the order, I'd like to be able to add the value from that input to the order's meta data. to that end, I created...
Captain Dando

View additional questions