Move Afterpay payment info
-
Hello! Is it possible to move the Afterpay info to BELOW the Add to Cart button on Single Product pages?
Regards
MelanieThe page I need help with: [log in to see the link]
-
Hello again – also wondering if it’s possible to only display the Afterpay info on certain products on Single Product pages. It would always display at Checkout.
Regards
MelanieHi @bantergroupaus,
Thanks for your messages.
To move the location of the Afterpay paragraph the ‘Set the hook to be used for Payment Info on Individual Product Pages’ setting can be updated. A hook implemented by the site theme in the desired location will need to be found and used. For instance it may be possible to use the
woocommerce_after_add_to_cart_formas long as the theme implements it. Alternatively if the site uses a page builder, the[afterpay_paragraph]shortcode can be applied.To allow Afterpay to be used for a product but change (or hide) the output of the paragraph on the product page the
afterpay_html_on_individual_product_pageshook can be leveraged. An example of this can be found here: https://developers.afterpay.com/afterpay-online/docs/woocommerce-hooksThank you.
Thank you!
So I’ve got the first part working as I’d like (moved the Afterpay info), but not having a lot of experience with Hooks, I’m a bit lost with how to display only on certain products.
I’ve read the page you linked to, but I don’t understand where I put that information, or how to select which products should display / hide the Afterpay info. Are you able to provide any further help?
Regards
MelanieHello again! I haven’t heard from anyone for a couple of days.
Hoping I could get some help with this issue.
Thank you
MelanieHi @bantergroupaus,
Again thanks for your message.
To show the Afterpay messaging for only a specific category, the below code can be used. This can be added to the
functions.phpfile of the active theme. This file can be found by going toAppearance > Theme Editorin the dashboard and selecting the active theme to edit. When pasting this snippet into the file, replaceYour Category Namewith the name of the category you would like to use.function afterpay_hoipp_callback( $str_html, $product, $price ) { $categories = get_the_terms( $product->get_id(), 'product_cat' ); $show_message = false; foreach($categories AS $category) { if (property_exists($category, 'name') && $category->name == 'Your Category Name') { $show_message = true; break; } } if (!$show_message) { $str_html = ""; } return $str_html; } add_filter( 'afterpay_html_on_individual_product_pages', 'afterpay_hoipp_callback', 10, 3 );This will remove the messaging unless the products are in the category that you would like displayed.
If the site theme is updated, the code *may* need to be added back to
functions.phpfile.Please note that as always when making modifications like this, the Afterpay team recommend testing this in a staging environment first and making sure to take a backup of the site files and database beforehand.
Thank you.
Thanks! I’m not using a Child Theme. Is there any way to make this change using the Code Snippets plugin?
Regards
MelanieHi @bantergroupaus,
Thanks for your message.
If the plugin in question is the one found here https://wordpress.org/plugins/code-snippets/, then according to its description it should be able to achieve the desired behaviour. Please note that as it is not possible for the Afterpay team to test every possible combination of theme and plugin in the WordPress ecosystem, the team cannot guarantee the behaviour of 3rd party plugins and how they will interact with the Afterpay plugin.
Thank you.
The topic ‘Move Afterpay payment info’ is closed to new replies.