WooCommerce “Checkout Now” button [closed]

Try this – Add your button inside a form and write down script to add product to the cart and redirect user directly to the checkout page. Suppose, following is the button that you can put on single product page using a WooCommerce hook. <button name=”checkout_now”> Checkout Now </button> PHP code: global $woocommerce; $post_id = … Read more

Create a regular post for every WooCommerce order

in comments I propose to make the order as public but I found a easier way to display a order : with a shortcode i try this in a plugin : add_shortcode(“view_order”, function ($atts, $content = “”, $tag) { if (!isset($_GET[“order_id”])) { return “no id”; } $order = get_post($_GET[“order_id”]); if ( !isset($order) || (“shop_order” !== … Read more

Woocommerce Product attribute not imported with wordpress Importer [closed]

WordPress default importer will not work for WooCommerce product attributes. There is a plugin available to import WooCommerce products which handles import for products as well as their attributes. I’ll not paste the plugin URL here since it’s a third party plugin, but if you google for ‘WooCommerce import’, you will easily get that plugin.

print script on wordpress header after user registered

There’s quite a few issues here: do_action(‘user_register’, $user_id ); No need to fire the action yourself (especially with an undefined variable $user_id) – the idea of actions & filters is that you “hook” your function to one, and then let WordPress trigger it when applicable. function MY_Callback(){ $data[‘user_id’] = $user_id; My_print_js($data); } Again $user_id is … Read more

Disable woocommerce PLACE ORDER button if user selected products that are not available for international delivery

Since I do not have a great answer for you after checking logic above (seems okay).. something else I noticed. add_action(‘woocommerce_update_order_review’ … Are you using the most recent update? I see no reference here docs.woothemes.com/wc-apidocs/hook-docs.html or on github depo for that do_action. Here is the current layout for hooks/filters on form-checkout.php.. Are you sure you … Read more

Woocommerce: Any way to list all products *without* a specific attribute?

I’ve had to do something similar recently, create a list of all attributes by product and product variation. I used SQL to produce the list. It’s a bit basic and I’m sure could be improved easily. SELECT wp_posts.id,wp_woocommerce_attribute_taxonomies.attribute_id, wp_woocommerce_attribute_taxonomies.attribute_name,wp_woocommerce_attribute_taxonomies.attribute_label, wp_posts.post_type, wp_posts.post_title FROM wp_woocommerce_attribute_taxonomies,wp_posts WHERE wp_posts.post_type=”product_variation” OR wp_posts.post_type=”product” I hope that helps, or points you in … Read more

Strip string from $_product->get_title() to get a cleaner mini-cart

You need to add a function in your theme’s functions.php file that will find and remove those two words “shorts” and “longshorts” from a php string. Then you can add that function as a filter to the woocommerce_cart_item_name event that is being applied in your mini-cart.php Try something like: function wpse_remove_shorts_from_cart_title( $product_name ) { $product_name … Read more