Closed jharbor closed 5 months ago
An example of how I have used the woocomerce_order_button_html filter is
add_filter( 'woocommerce_order_button_html', 'custom_order_button_html');
function custom_order_button_html( $button ) {
$order_button_text = __('Pay Now', 'woocommerce');
$js_event = "";
$button = '
<div class="pt-5 d-flex justify-content-between align-items-center">
<a href="#/">Go back</a>
<input type="submit" onClick="'.$js_event.'" class="col-auto ms-auto d-block btn btn-primary alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />
</div>';
return $button;
}
It would be great if one existed for the Address screen or a general button hook that could be used
Why not override and modify the a template copy directly? Yes there will be an additional update merge maintenance burdain, but it's unfeasible for core to add such filters everywhere.
Using hooks and filters removes (or at least reduces) the burden of remaking your customizations every time an update comes out.
A few reasons to avoid overriding the core templates are because repeating customization work eventually leads to missing or forgetting something, as well as avoiding unnecessary time spent re-doing work that’s already been done.
On Fri, Dec 24, 2021 at 7:26 AM Leho Kraav @.***> wrote:
Why not modify the template directly?
— Reply to this email directly, view it on GitHub https://github.com/woocommerce/woocommerce/issues/31489#issuecomment-1000839512, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGZLFSAIHUJZAOPVUE4OVJDUSRYG5ANCNFSM5KQTQKLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
Using hooks and filters removes (or at least reduces) the burden of remaking your customizations every time an update comes out.
A few reasons to avoid overriding the core templates are because repeating customization work eventually leads to missing or forgetting something, as well as avoiding unnecessary time spent re-doing work that’s already been done.
Yeah, but the amount of filters that could or should exist across templates is just infeasible for core to maintain, too.
I have developed a git- and splitsh-based workflow, that eases the template update maintenance and upgrades considerably. Maybe it should be published for public benefit.
Using a child theme for all the template customization is pretty easy. and WP website must have a child theme since the start because you will need to add some customizations for sure 1 day in the future for your website.
Given that there is a viable workaround with custom templates, going to close this.
Describe the solution you'd like
I need to be able to edit the 'Save Address' button class/html on the 'My Account' -> 'Edit Address' screen(s)
Please add to core something similar to
apply_filter('woocommerce_order_button_html')
so that I can modify the html of the button using a hook.This would also allow to echo additional content/notes about validations and custom instructions.
Describe alternatives you've considered
No response
Additional context
No response