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 questionI 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 questionI 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 01 Answer
Reset to default 1In version 4.2.1 they add the function esc_html to the option text. Here the link to version 4.2.0 for comparison.