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

Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress.

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742313390a4420351.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信