Backend custom field: https://prnt.sc/15ej56f
Vendor frontend: https://prnt.sc/15ej8qc
This is the code that we used in adding the custom field to the Auctions tab:
add_action('woocommerce_product_options_auction', 'add_my_custom_product_data_fields');
function add_my_custom_product_data_fields() {
woocommerce_wp_select(
array(
'id' => '_auction_vehicle_soldas',
'label' => __( 'Vehicle Sold as', 'wc_simple_auctions' ),
'options' => array( '' => 'Please select', 'asis' => 'As Is', 'safetied' => 'Safetied'),
)
);
}
add_action('woocommerce_process_product_meta', function($post_id) {
$product = wc_get_product($post_id);
$auction_vehicle_soldas = isset($_POST['_auction_vehicle_soldas']) ? $_POST['_auction_vehicle_soldas'] : '';
$product->update_meta_data('_auction_vehicle_soldas', sanitize_text_field($auction_vehicle_soldas));
$product->save();
});
]]>Can anyone help me?
]]>I am wondering if and how I can expand the excerpt panel. I am using the main edit window for longer case studies and the excerpts as shorter but still styled home page items. I’d like to make he excerpt panel larger and add the various formatting elements that one has in the main edit panel.
Point me in the right direction if you can. Thanks!
]]>I have created a set of custom write panels. I’ve also created a function that hides unnecessary panels by including a stylesheet in the admin_head depending on the category the post belongs to.
for instance.
When post belongs to cat=3 write style sheet reference to admin_head and hide the appropriate panels.
Now, the problem. They were displaying correctly the first time and now the panels that were hidden have an inline style added to the custom panel div of [style=”display:none;”]. How did that get added and how do I control this?
Thanks.
]]>