Posts

Showing posts with the label woocommerce

How to add multiple variable products to the cart via the add-to-cart query string

Image
Clash Royale CLAN TAG #URR8PPP How to add multiple variable products to the cart via the add-to-cart query string I want to add two variable product into my cart when i clicking a link on my site. i added below code in my function.php this code is only working with the simple product its not working with the variable product. function woocommerce_maybe_add_multiple_products_to_cart( $url = false ) { // Make sure WC is installed, and add-to-cart qauery arg exists, and contains at least one comma. if ( ! class_exists( 'WC_Form_Handler' ) || empty( $_REQUEST['add-to-cart'] ) || false === strpos( $_REQUEST['add-to-cart'], ',' ) ) { return; } // Remove WooCommerce's hook, as it's useless (doesn't handle multiple products). remove_action( 'wp_loaded', array( 'WC_Form_Handler', 'add_to_cart_action' ), 20 ); $product_ids = explode( ',', $_REQUEST['add-to-cart'] ); $count ...

Set Woocommerce product thumbnail with new thumbnail PHP

Image
Clash Royale CLAN TAG #URR8PPP Set Woocommerce product thumbnail with new thumbnail PHP I have created a custom plugin to import and export woocommerce products. I am facing an issue that when i try to import the CSV, the thumbnails of the products got changed and set to the old one which were added to the products earlier. I have full image URL in the CSV. Here is my import code: $product_img = $row[13]; //Product Image $res = $wpdb->get_results('select post_id from ' . $wpdb->prefix . 'postmeta where meta_value like "%' . basename($product_img). '%"'); if(count($res) == 0) { $res = $wpdb->get_results('select ID as post_id from ' . $wpdb->prefix . 'posts where guid="' . $product_img . '"'); } $thumbnail_id = $res[0]->post_id; set_post_thumbnail( $product_id, $thumbnail_id ); $attach_data = wp_generate_attachment_metadata( $thumbnail_id, $product_img ); wp_upda...

Filtering WooCommerce Products by $_GET

Image
Clash Royale CLAN TAG #URR8PPP Filtering WooCommerce Products by $_GET What I need to be able to do is apply a value for an attribute in the URL, so only the products match that attribute are displayed. I don't want to do any widgets or other visible filters on the page. For this I presume I would need to use one of the webhooks, and filtering out all products that are about to be displayed. Can anyone advise which hook will be best in this case and a simple explanation on how the triggered function will return the new array of products? Thanks in advance! By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Disable new attributes values for WP All import Woocommerce

Image
Clash Royale CLAN TAG #URR8PPP Disable new attributes values for WP All import Woocommerce Is it possible to create some function to disable WP All import to create new attribute values? I want to create a function that will update product attribute values only if there is already in Woocommerce. I want to do this because it is very hard to map all attribute values when it comes to 5k products and more. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

how to delete completed orders in woocommerce using a my sql query

Image
Clash Royale CLAN TAG #URR8PPP how to delete completed orders in woocommerce using a my sql query I want to delete completed all orders in woocommerce by using a single my sql query . Because, I'm having a problem with my WordPress Dashboard . I can't view the completed orders from the back-end. It's getting blank. I have 7,823 Completed Orders . I hope that's why I seen white page when I'm going to view the Completed Orders . WordPress Dashboard 7,823 Completed Orders Completed Orders Is there have a way to, That I can delete all Completed Orders using MySQL query. So, that I can run it in PHPMYADMIN . Completed Orders PHPMYADMIN Have any suggestions. have you checked to just see if there's PHP errors and that's why theres a white page? Usually the reason – Andy Holmes Jul 23 '14 at 7:36 ...

How to correctly add your message to the “Thank you” page? Woocommerce 3

Image
Clash Royale CLAN TAG #URR8PPP How to correctly add your message to the “Thank you” page? Woocommerce 3 Need add custom message after "Thank you. Your order has been received.". A variable has been added to my message. It contains the percentage of the total amount of the order. In general, I think that this is a working option, but if there are errors, please write the correct answer. add_filter('woocommerce_thankyou_order_received_text', 'woo_change_order_received_text', 10, 2 ); function woo_change_order_received_text( $str, $order ) { // Get order total $order_total = $order->get_total(); $percent = get_option( 'wc-custom-percent' ); // Percentage $order_saving = (float)($percent * $order_total / 100); // Bonus amount $new_str = $str . ' You participate in the bonus program, your bonus interest from this order is' . $order_saving . ' euros. <a href="#">Learn more about the bonus program.</a>...

WooCommerce product variations are not showing, while these are in database

Image
Clash Royale CLAN TAG #URR8PPP WooCommerce product variations are not showing, while these are in database We are facing an issue with woocommerce variations, please note there is No wordpress update, No plugin update The variations are present in database tables for each product but not showing when editing the product, also at frontend price and dropdown are showing, but when I trying to select an option showing error "Sorry, this product is unavailable. Please choose a different combination.". When I am creating the variations from available attributes its starts working fine. Have you replaced DB? – Sudharshan Nair 3 mins ago By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie pol...

Add a row in Woocommerce order edit pages after order total

Image
Clash Royale CLAN TAG #URR8PPP Add a row in Woocommerce order edit pages after order total I need to exchange two of the rows in my checkout-review-order-table (taxes and total price) - I want the taxes displayed above the total price and then I need an info text below the total price and in an additional row. It would be great if there was a possibilty to solve the problem in the functions.php Please let me know if you need any additional information. Thank you so much for helping! :) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.