Hi David, thanks for using and enjoying the plugin!
Currently, unfortunately, there is no possibility to import products with Flexible Quantity values, but this functionality is on our roadmap. I will let you know when it is implemented.
Could you tell me if there is a way to get some info such as the selected measurement unit by coding? Is there any global variable with the appropriate function to get such info?
Hello @argate7
Save the FQ settings in the product edit panel.
Then go to the product meta key called flexible_quantity_settings which stores information about all settings – including measurement units.
Then deserialize this array and get the needed data.
I get the info from wp_postmeta but I was looking for a function to deserialize the meta_value column data.
Hello @argate7
This could help.
$product = wc_get_product( $product_id );
$fq_settings = $product->get_meta('flexible_quantity_settings', true);
if( is_array( $fq_settings ) && isset( $fq_settings['fq']['unit'] ) ){
$unit = $fq_settings['fq']['unit']; //unit from product settings
var_dump( $unit ); //show
if( class_exists('WDFQVendorFree\WPDesk\Library\FlexibleQuantityCore\WooCommerce\Units') && !empty($unit) ){
$all_units = WDFQVendorFree\WPDesk\Library\FlexibleQuantityCore\WooCommerce\Units::get_all_units(); //get all units settings
var_dump( $all_units[$unit]); //more info about unit
}
}
If you want to use the class WDFQVendorFree\WPDesk\Library\FlexibleQuantityCore\WooCommerce\Units
then please make sure that the code executes when the plugin is loaded.
I am marking this topic as resolved as we have not received any new replies. Please let us know if you need our help again.