I have modified your code please check the below code.
function add_octopus_child_option( $product_type_options ) {
$product_type_options['childocto'] = array(
'id' => '_childocto',
'wrapper_class' => 'show_if_octopus',
'label' => __( 'Gekoppeld', 'woocommerce' ),
'description' => __( 'Vink dit aan indien dit niet het hoofdproduct is.', 'woocommerce' ),
'default' => 'no'
);
return $product_type_options;
}
add_filter( 'product_type_options', 'add_octopus_child_option' );
function save_product_data_octopus($post_id){
$woocommerce_checkbox = isset( $_POST['_childocto'] ) ? 'yes' : 'no';
update_post_meta( $post_id, '_childocto', $woocommerce_checkbox );
}
add_action( 'woocommerce_process_product_meta_simple','save_product_data_octopus' );
add_action( 'woocommerce_process_product_meta_variable', 'save_product_data_octopus' );
Try with the above code and if does not work let me know.
Related Posts:
- Use wc_enqueue_js only on specific pages – nested add_action
- woocommerce subscriptions – get expiration date [closed]
- Automated Cart Update With Alert Box Each Time
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to auto fetch customer details in Woocommerce in checkout page
- I want to add custom add to cart link [closed]
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Change product_base programmatically
- Can a plugin redirect product page based on IF condition?
- WordPress WP_Query without query GET parameters
- Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?
- custom post type with role Vendor
- Woocommerce custom Plugin in wordpress [closed]
- Add a custom WooCommerce settings tab with sections
- Payment field disappears on custom Paypal plugin
- I am having errors with checkout on wordpress
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Looping through and combining calls to Woocommerce REST API
- How to import woocommerce custom fields data into another site?
- How do I remove an action hook inside a class that is called by another class?
- How keep woocommerce users separeted in multisite install and keep admins on network
- Custom field fetch error on woocommerce pdf invoice
- Woocommerce Convert existing order to the cart
- How to change product SKU’s in bulk with a plugin
- How to add product in woocommerce with php code [closed]
- Should I use spl_autoload_register() in my plugin?
- How can I save a multiple select array with the settings API for a plug-in options page?
- Using register_activation_hook in classes
- Creating custom Woocommerce attribute taxonomies from a plugin
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to get the original price of the product in woocommerce?
- Making Quote Plugin more efficient
- Writing scripts using WordPress / WooCommerce classes?
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- How to make custom total price reactive in navigation
- Change description on specific WooCommerce product status change
- How to add a second ‘place order’ button in WooCommerce [closed]
- Instantiate class to be available to all plugin functions
- How to test nonce with AJAX – Plugin development
- WP nonce invalid
- Woocommerce redirect thankyou page based on product ID doesn’t empty Cart
- tracking number field in Woocommerce order [closed]
- Reprinting tags with all attributes
- Add a product to checkout via form
- Trying to place a custom field after the total section in the checkout page in woocommerce
- WordPress default Search function inconsistent in WooCommerce Product Titles
- How can I get the values of my WordPress $wpdb query in Jquery?
- Adding function to Genesis genesis_header [closed]
- My new button is in the wrong place
- Redirect to another page using contact form 7? [closed]
- Custom plugin settings link doesn’t append current class to menu item when visited? Why?
- How to hook code to show after the_content?
- woocommerce related product title length
- Why does my settings form redirect to the homepage?
- How to separate product payment and shipping payment in WooCommerce checkout? [closed]
- Output product category link from WP_Query
- How to get woocommerce orders with get_posts method in a shortcode
- Variation prices breakdown only for single product page
- Woocommerce disable order item link (backend) [closed]
- Post form – AJAX won’t upload featured image – Plugin development
- Set all WooCommerce Products to Simple, Virtual & Downloadable
- Undefined array key 0 wp-includes/capabilities.php on line 76
- Display a custom name when the user has no name settle in his account
- Add to cart quantity dynamic
- Discount in the specific product title using keyword ( Woocoommerce )
- Place product field value as variable in php
- Change WooCommerce currency programmatically on AJAX request
- Woocommerce textarea format ignored
- Autoloading Classes in Plugins
- How can I add another row to the total field in WooCoommerce cart, checkout and recipe mail?
- Put a span class in the shortened product title
- Add missing alt tag to featured images for “storefront” theme
- How to limit functionality of a woocommerce plugin to only certain user role?
- Display specific main Sub Nav on Woocommerce product pages
- Comparing Dates within plugin using PHP If statement
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- Use PHP code in Menu Admin Section
- Need Quick Help With Product Category Page
- Singleton plugin activation; create database
- How to get WordPress Adminmenu items?
- How to set up and use a custom upload directory for post type ‘product’
- How to get the rating value of each comment
- Exclude specific product tags from related products in WooCommerce 3+ [closed]
- WooCommerce Orders pagination
- Product Category Page in Full Width
- After declaring woocommerce theme support products are no longer displayed
- Replace the image of a product with its video in the shop page
- Import users and custom user meta from csv
- Prevent users from display default wordpress login form
- Create custom table for wordpress custom registration flow
- Authenticate + Authorize WP REST API request before built-in WP JSON Schema Payload Validation?
- How call WordPress shortcode inside function file
- strict custom php script on specific product category [closed]
- WordPress wp_set_object_terms does not assign product to custom taxonomy
- PHP Add products to cart with WooCommerce Addons
- Woocommerce attatch files and custom input meta to cart items and then to order
- Woocommerce, via php snippet: How to get product price and divide it by a number from an attribute, and then display the new price via php/html?
- WooCommerce: Custom dropdown for variation selection
- WooCommerce coupon codes in order overview HPOS