我正在创建 woocommerce 插件,并且我有一个自定义订单状态“wc-shipped”。我只想为此自定义订单状态执行一些插件选项。这是我的代码
add_action('text_sms_form_fields', 'sms_woocommerce_fields', 10, 1);
function sms_woocommerce_fields($textme_option, $wc_statuses_arr) { ?>
if( isset( $wc_statuses_arr['wc-shipped'] ) ) { ?>
<hr>
<fieldset>
<label for="textme_order_shipped">
<input name="textme_order_shipped" type="checkbox"
id="textme_order_shipped" <?php if ($textme_option['textme_order_shipped'] == "1") {
echo 'checked';
} ?>
value="1"/>
<span><?php esc_html_e('Send SMS when order status is shipped ', 'send_sms'); ?></span>
</label>
</fieldset>
<div class="textme_order_shipped_content <?php if ($textme_option['textme_order_shipped'] != '1') {
echo 'hidden';
} ?>">
<table>
<tr>
<td></td>
<td><textarea id="textme_order_shipped_sms_customer" name="textme_order_shipped_sms_customer"
cols="80" rows="3"
class="all-options"><?php if ($textme_option['textme_order_shipped_sms_customer']) {
echo $textme_option['textme_order_shipped_sms_customer'];
} ?></textarea>
</td>
</tr>
</table>
</div>
<?php } ?>
我想如果“wc-shipped”状态存在然后显示这些插件选项,但我得到以下错误。
如何解决这个问题?