最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - "woocommerce_form_field()" function having issues after latest woocommerce update

programmeradmin3浏览0评论
Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

I have this custom code that was working without issue prior to the latest update of woocommerce, but after the update, the HTML markup in the options field is now showing on the live site. TO be clear, the
tag is now showing whereas before it added the line break it was supposed to do.

add_action( 'woocommerce_after_order_notes', 'checkout_outofstockoption' );

function checkout_outofstockoption( $checkout ) {

    echo '<div id="my_custom_checkout_field"><h3>' . __('Option if product is not available') . '</h3>';

    woocommerce_form_field( 'outofstockoption', array(
        'type'          => 'radio',
        'class'         => array('my-field-class form-row-wide'),
        'label'         => __('We try our best to ensure accurate stock levels. However, in the event that your product is out of stock, please let us know how you would like us to proceed:<br />'),
        'options'       => array('Substitute'=>' Substitute with a similar item of equal or greater value (if no suitable substitute is available a credit will be issued)<br />','Credit'=>' Receive store credit<br />'),
        'required'      => true
        ), $checkout->get_value( 'outofstockoption' ));

    echo '</div>';
}

Was there something different to do that changed in the new update?

Thank you in advance for the help

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

I have this custom code that was working without issue prior to the latest update of woocommerce, but after the update, the HTML markup in the options field is now showing on the live site. TO be clear, the
tag is now showing whereas before it added the line break it was supposed to do.

add_action( 'woocommerce_after_order_notes', 'checkout_outofstockoption' );

function checkout_outofstockoption( $checkout ) {

    echo '<div id="my_custom_checkout_field"><h3>' . __('Option if product is not available') . '</h3>';

    woocommerce_form_field( 'outofstockoption', array(
        'type'          => 'radio',
        'class'         => array('my-field-class form-row-wide'),
        'label'         => __('We try our best to ensure accurate stock levels. However, in the event that your product is out of stock, please let us know how you would like us to proceed:<br />'),
        'options'       => array('Substitute'=>' Substitute with a similar item of equal or greater value (if no suitable substitute is available a credit will be issued)<br />','Credit'=>' Receive store credit<br />'),
        'required'      => true
        ), $checkout->get_value( 'outofstockoption' ));

    echo '</div>';
}

Was there something different to do that changed in the new update?

Thank you in advance for the help

Share Improve this question asked Jun 26, 2020 at 18:27 vredvred 1 0
Add a comment  | 

1 Answer 1

Reset to default 1

In version 4.2.1 they add the function esc_html to the option text. Here the link to version 4.2.0 for comparison.

发布评论

评论列表(0)

  1. 暂无评论