continue to shipping button text and continue to payment button text
in website woocommerce checkout is there any solution for this pls help me
SH1
Sh2
My website
Cosmeticsonlinehubb.pk
I have tried all plugins but still got not solution for this.
you can change by adding this code to your theme's functions.php
function my_custom_checkout_button_text() {
return 'My Custom Text';
}
add_filter( 'woocommerce_order_button_text', 'my_custom_checkout_button_text' );
You have to change the value which obviously is the My Custom Text to whatever you want.
Friendly, George
I have a problem using woocommerce.
After I add a product to cart the link in browser becomes link/?add-to-cart=72,and if i refresh the page the product is added again in cart.
Every refresh addes the product in cart.
I disabled all plugins except woocommerce and still the same.
Any ideea on how to fix this ?Thank You.
I had the same issue once, here is the code that you should add to your theme’s functions.php file, or to your own custom plugin:
add_action('add_to_cart_redirect', 'cipher_add_to_cart_redirect');
function cipher_add_to_cart_redirect($url = false) {
// If another plugin beats us to the punch, let them have their way with the URL
if(!empty($url)) { return $url; }
// Redirect back to the original page, without the 'add-to-cart' parameter.
// We add the `get_bloginfo` part so it saves a redirect on https:// sites.
return get_bloginfo('wpurl').add_query_arg(array(), remove_query_arg('add-to-cart'));
}
It will add a redirection when users added products to their cart. I hope this helps.
So I have attached an image of my issue.
Basically I followed the instructions on this Stack Overflow question thread right here:
Text under Add to cart (woocommerce)
I posted my question there 5 times and someone kept removing it, so I'm posting it again here. Please advise.
Update: I have already tried the paragraph tag, the break tag, and the pre tag.
You could try this (as you will see this is a CSS styling issue with the margin-top):
add_action( 'woocommerce_after_add_to_cart_button', 'custom_content_after_addtocart_button', 100 );
function custom_content_after_addtocart_button() {
// custom content.
echo '<br/><div><p style="font-size:10px; font-style=italic; margin-top:20px;">(*Contact us for bulk purchase enquiry)</p></div>';
}
Code goes in function.php file of your active child theme (active theme or in any plugin file).
Tested and works. You will get that:
This code will place it nicely below the Add to Cart button :
add_action( 'woocommerce_after_add_to_cart_form','content_after_addtocart', 100 );
function content_after_addtocart() {
// place your content below.
echo 'Hello There !!';
}
As I understand by default Woocommerce shop page uses product archive template. What I am looking for, is to use a custom template for shop page.
Here is what I did:
Create template "my-shop"
Create page "My shop" -> choose template "my-shop"
Choose "My shop" as Woocommerce shop page
But none of the changes I made to "my-shop" template are present on the shop page.
What am I missing here? I would not like to change product archive itself, just the shop page.
Is there a way to disable product archive from being a default for shop page?
Thanks
I know it's too late and you may have figured it out by now. In any case, the changes that you would like to make to the WooCommerce Shop Page need to be done in the archive-product.php and it would be safer to create a child theme and do these changes. Making enhancements and customizations in a Child theme is best practice so that you can update the parent theme at any time and it won't affect your store.
I hope this helps, for more information on how you can use WooCommerce short-codes to customize your store can be found here.
To add to Silver Ringvee's answer - he used is_page but that only works on wordpress pages. For woocommerce you need to use something like is_woocommerce() . See Woocommerce conditional tags page.
My example code uses the is_shop conditional tag as that was the page you wanted to change. the code get_template_part( 'content', 'shop' ); will call the file content-shop.php in your theme root folder. This code is to be added at the top of wp-content\themes\*theme*\woocommerce\archive-product.php that you can copy from wp-content\plugins\woocommerce\templates\archive-product.php
You can add it just before get_header( 'shop' ); line 23 in my file - and the entire page will be drawn from your template. If you want to keep the header of the shop page, then put this code after the get_header code. Remember to include a footer in your file as well
if (is_shop()) {
get_template_part( 'content', 'shop' );
} else {
#normal archive-product code here
}
The solution (not perfect) that I figured to work best, until someone finds a way to actually change the template from dashboard:
Adding:
<?php
if (is_page( 'Page Title' ) ):
# Do your stuff
endif;
?>
to content-product.php in my theme's woocommerce folder.
If you prefer to go with code, you can create a redirect from the original shop page to your page via wp_redirect.
add_action('template_redirect', 'bc_010101_redirect_woo_pages');
function bc_010101_redirect_woo_pages()
{
if (is_shop())
{
wp_redirect('your_shop_url_here');
exit;
}
}
More detailed tutorial can be found here
This is not possible to create custom template for shop page , just copy and paste woocommerce Templates into you theme folder and Try to work in content-product.php template .
On the woocommerce checkout page I want to move the field where the apply coupon input is and place it just below the order summary and above the payment options. I'm not sure how to change the php because the checkout page is comprised of multiple php files therefore I come to you genius people to help. Anybody know how I can achieve this? Thank you in advance!
P.S. I've added pictures; the first is of the top half of the page and the second is of the second half of the page.
#noufalcep you answer is not clear.
Finally after everything i came up with a working solution. i am using woocommerce 3.2.5 and wordpress version of 4.8.3.
As #noufalcep said the form inside form is not the issue. When we do
add_action( ‘woocommerce_checkout_after_order_review’, ‘woocommerce_checkout_coupon_form’ );
coupon container doesn't wrap up with form element. But the button has submit as input type. That's why when we apply coupon main form get suibmitted.
Therefore what i did is inserted the coupon form with jquery insertAfter. Below is the code. It is perfectly working.
var coupon = $(".checkout_coupon");
coupon.insertAfter('.shop_table.woocommerce-checkout-review-order-table');
Then this will add the form after review order table. if you want it with "Have a coupon? Click here to enter your code" text, you have to wrap the element with the form.
A working example can be seen here,
https://themovementfix.com/checkout/
If you are comfortable editing your functions.php file inside your theme directory, then you can add the following lines of code:
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
add_action( 'woocommerce_after_checkout_form', 'woocommerce_checkout_coupon_form' );
This will essentially remove the coupon (which is hooked before the checkout form) and re-add it AFTER the checkout form.
Alternatively, you can use Javascript to "cut&paste" the html block containing the coupon fields, but this is a messy way of coding and I would not suggest taking that route.
This worked great for me:
Add this jQuery:
(function($) {
$(document).ready(function() {
var coupon2 = $(".checkout_coupon.woocommerce-form-coupon");
coupon2.insertAfter('.shop_table.woocommerce-checkout-review-order-table');
})
})
(jQuery);
Add this css:
/*unhide copuon code checkout*/
.checkout_coupon {
display: block !important;
}
/*hide message have a coupon?*/
.woocommerce-info {
display:none;
}
/*coupon code checkout style*/
.checkout_coupon button.button{
background-color: #insert button color here;
}
This how I put the coupon form after the billing total. So it would be more helpful to use while customization.
Just place this code inside your functions.php and see the customization on the frontend.
/*
* Removing default "Coupon form" from the top of the checkout page
*/
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
/*
* Hooking "Coupon form" after order total in checkout page with custom function
*/
add_action( 'woocommerce_review_order_after_order_total', 'woocommerce_checkout_coupon_form_custom' );
/*
* Rendering html for "Coupon form" with custom function
*/
function woocommerce_checkout_coupon_form_custom() {
echo '<tr class="coupon-form"><td colspan="2">';
wc_get_template(
'checkout/form-coupon.php',
array(
'checkout' => WC()->checkout(),
)
);
echo '</td></tr>';
}
After reading about the form within a form issue that stops the usual add_actions from working, it inspired me to create a form-checkout.php file in my theme’s woocommerce folder, and simply move the order review's starting < form ... > code to right after the do_action( ‘woocommerce_checkout_before_customer_details’ ); line, then used these two lines to move the coupon form down to under the Your Order review display, and it worked great in v3.0.x of WooCommerce:
remove_action( ‘woocommerce_before_checkout_form’, ‘woocommerce_checkout_coupon_form’, 10 );
add_action( ‘woocommerce_checkout_after_order_review’, ‘woocommerce_checkout_coupon_form’ );
Without moving the starting form code, it wouldn’t work due to the form within a form issue mentioned, but once moved, works easily.
As of woocommerce 2.6 (or maybe even earlier) placing it "after order review" no longer works. If you apply a coupon it will place the order automatically. It's caused by the form within a form issue.
In Woocommerce 2.6, using hooks alone, only these 2 options currently work:
option 1:
add_action('woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form');
option 2:
add_action('woocommerce_after_checkout_form', 'woocommerce_checkout_coupon_form');
The problem is that the whole checkout page is inside a form, and the coupon is a form also. And you are unable to nest two forms. So even though you could technically move the coupon form above the review order section, it won't work properly. You need to rearrange your form and split them into two to make it work.
Move WooCommerce Coupon Field in Checkout Page
Using process: You can use the code using any plugin like (Code snippets) or function.PHP
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
add_action( 'woocommerce_review_order_after_cart_contents', 'woocommerce_checkout_coupon_form_custom' );
function woocommerce_checkout_coupon_form_custom() {
echo '<tr class="coupon-form"><td colspan="2">';
wc_get_template(
'checkout/form-coupon.php',
array(
'checkout' => WC()->checkout(),
)
);
echo '</tr></td>';
}
A slight revision on a suggested answer:
remove_action('woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10);
add_action('woocommerce_review_order_before_payment', 'woocommerce_checkout_coupon_form');
This places the coupon input below the order and above the payment options.