I need assistance with customizing a woocommerce thankyou.php file and new-order.php file.
I want to show an image before a zapper gateway instructions on the thank you email and also show it on the email sent to client for payment.
I have the image showing problem in the thankyou.php page but its also showing on all payment gateways not only on the zapper gateway and its not showing on the new-order email sent to client.
here is the code for the thankyou.php
<?php if ( $order->get_payment_method_title() === 'zapper' ); ?> <div class="zapper"> <?php echo '<p style="margin-top:0;"><img src="webiste.com/wp-content/uploads/2017/10/zapper-process.jpg"; /></p>'; ?>
Regards
Bongani
You can use a specific hook for your payment gateway woocommerce_thankyou_{payment gateway}.
add_action( 'woocommerce_thankyou_zapper', 'message_for_zapper', 5 );
function message_for_zapper( $order_id ) {
echo '<div class="zapper"><p style="margin-top:0;"><img src="webiste.com/wp-content/uploads/2017/10/zapper-process.jpg" /></p>';
}
More examples here https://rudrastyh.com/woocommerce/thank-you-page.html#add_form
Related
for some reason the emails being sent to customers after they create a WooCommerce account displays a random name (see attached).
WooCommerce username error
I think because users can create an account with just an email address? But anyway - I want to just remove the Hi xxxx from all email communication from the customer. How do I do this? I am looking at the email templates but can't see how this code is generated?
To remove the name from email communication, you need to copy the email template file in your theme directory (e.g - customer-processing-order.php) on this find the below code:
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
And replace with the below mentioned code:
<p><?php printf( esc_html__( 'Hi,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
Same thing you can do for following Woocommerce email template files:
customer-completed-order.php
customer-completed-order.php
customer-invoice.php
customer-note.php
customer-on-hold-order.php
customer-processing-order.php
customer-refunded-order.php
Thanks - yes that solved the issue. The problem occurred because of a plugin conflict with a translation plugin. Thanks for the response to the question.
I've added a custom slide-out box to show a user's Buddypress notifications on any page.
https://imgur.com/ellepqp
I'm essentially echoing the template part from the Buddypress plugin Youzify (formerly known as Youzer). Youzify is just an extension to redesign Buddypress so I believe this problem is not necessarily related to that but rather native Buddypress.
I am able to get the Notifications for the current user when I'm on any standard Wordpress page. However, if I'm on a user's profile, it shows THEIR Notifications instead! I know that by default, Admins can actually see all Notifications if they simply add /notifications to any profile slug, but this is happening for standard Users too.
This is the current code:
<?php global $bp;
if( bp_has_notifications($bp->loggedin_user->id) ) : ?>
<?php bp_get_template_part( 'members/single/notifications/notifications-loop' ); ?>
<div class="read-all-notifs"> View All Notifications</div>
<?php else : ?>
<?php bp_get_template_part( 'members/single/notifications/feedback-no-notifications' ); ?>
<?php endif; ?>
I assume it's something to do with the template part and some function that forces the bp_displayed_user ID when on a Buddypress page, so how can I override that to make sure the Notifications in my popup are always for the current user on ANY page? Anyone have any ideas? Thanks.
I figured this out with help from a developer. This is the correct formatting for the initial part:
<?php if ( is_user_logged_in() && bp_has_notifications( array('user_id' => bp_loggedin_user_id(), 'per_page' => 10, 'search_terms' => false ) ) ) : ?>
The search terms part was added because on any search results page it was showing the 'No Notifications' loop for everyone.
In checkout page i had added extra fields but it is not showing up in billing address section in Thank you page.Nobody has answered this question.i added extra field like area in checkout page.i want to display it in billing_address in Thank you page.how to do it.
I guess you have added the extra fields in the billing section as described over here: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/#section-6
So now, you can use the 'woocommerce_thankyou' hook to display the value of fields.
Something like this:
<?PHP
add_action( 'woocommerce_thankyou', 'show_data_on_thankyou_page', 20 );
function show_data_on_thankyou_page( $order_id ){ ?>
<section class="custom-billing-details">
<p class="woocommerce-customer-details--nif"><span>NIF: </span><?php echo get_post_meta( $order_id, '_billing_nif', true ); ?></p>
</section>
<?PHP
}
?>
I very new to Woocommerce and Wordpress, I am trying to add a different company logo to each different products in grid but I am not able to do it, I have also tried to find any plugin related to it but I found nothing. Please Friends if you know how to do it do let me Know.
There is the below image of what I am trying to get but not able to :
Click Here for Image
First download the acf plugin then make the image field for wooCommerce product only , After made the image field for products, Try " woocommerce_after_shop_loop_item_title " hook in function.php file ,where you can echo the image field of acf by "get_field" function for ACF. "here is the link : ---- https://www.advancedcustomfields.com/resources/image/".
<?php
// define the woocommerce_after_shop_loop_item_title callback
function action_woocommerce_after_shop_loop_item_title( ) {
// make action magic happen here...
$image = get_field('image'); // ACF field name/slug.
if( !empty($image) ){
?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php
}
};
// add the action
add_action( 'woocommerce_after_shop_loop_item_title', 'action_woocommerce_after_shop_loop_item_title', 10, 0 );
?>
This will show the image on products ,After that do some styling on that in your theme style.css
If above hook does not work try this hook "woocommerce_after_shop_loop_item",
I have a WordPress website with Woocommerce installed.
How can I add delivery address to the 'new order' email sent to admins? I have found how to edit this email but can't find the correct syntax.
Thanks
Please try putting this snippet in you active themes functions.php
add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_details_to_admin_emails', 15, 2 );
function wc_add_shipping_details_to_admin_emails( $order, $is_admin_email ) {
if ( $is_admin_email ) {
<p><?php echo $order->get_formatted_shipping_address(); ?></p>
}
}
In the dashboard go to Woocommerce -> Settings -> Emails and then click on the gear button in the new order email column. There will be a field to input the address. You can input multiple emails in this field, just separate them with a comma.