It is possible with the customization, default shortcode displays only bullet points format.
Thread Starter
PD
(@privatecollection)
Can you give me some hint so that I can customize it?
There is a filter hook available “slw_shortcode_product_location_stock”, you may use it to alter the results. I didn’t mean to say that you customize it yourself, if you have developer in-house so he can perform this task for you or you may use the urgent help option under the help tab for custom development work.
Thread Starter
PD
(@privatecollection)
I am a developer.
Right now all size default is open, it has to be done in one Dropdown.
size screenshot:- https://prnt.sc/DETJS9Zm2Rlq
have to do:- https://prnt.sc/42L8L2YtYruB
The size that I select in the dropdown, and its store location are to be displayed below.
Here is another shortcode for you
File: https://plugins.svn.ww.wp.xz.cn/stock-locations-for-woocommerce/trunk/src/classes/class-slw-shortcodes.php
Line no. 248
Reference function output_product_locations_for_shortcode($product, $locations, $values)
You may use the following filter to build your own outcome in dropdown format.
$output = apply_filters( 'slw_output_product_locations_for_shortcode', $product, $locations, $values, $output );
Thread Starter
PD
(@privatecollection)
Thank You For the solution.
Sorry, but Where to replace this code?
I tried a lot using this code but nothing has changed.
Please confirm, are you a developer? If yes, please confirm, do you know how to use filter hooks? In case not, please either learn to use filter hooks or use the urgent help option on settings page under the help tab.
This is a sample code which you can use to produce the dropdowns, I hope it would help.
remove_filter('slw_output_product_locations_for_shortcode', 'slw_output_product_locations_for_shortcode_callback', 9, 4);
add_filter('slw_output_product_locations_for_shortcode', 'flatsome_output_product_locations_for_shortcode_callback', 8, 4);
function flatsome_output_product_locations_for_shortcode_callback($product, $locations, $values, $output){
//pree($locations);
if(!empty($locations)){
$output = '';
$positive = 0;
foreach($locations as $location){
$_stock_at = get_post_meta($product->get_id(), '_stock_at_'.$location->term_id, true);
if($_stock_at){
$positive++;
}
$output .= '<li class="'.($_stock_at?'bullet-checkmark':'bullet-crossmark').'"><strong>'.$location->name.'</strong>
<small class="'.($_stock_at?'in-stock':'out-stock').'">'.($_stock_at?'- '.__('In stock', 'woocommerce'):'- '.__('Out of stock','woocommerce').'').'</small>
</li>';
}
if($positive){
$output = '<li class="bullet-checkmark"><strong>På lager online - GLS 1 - 3 hverdage</strong></li>'.$output;
}
$output = '<ul>'.$output.'</ul>';
}
return $output;
}
add_action('woocommerce_after_add_to_cart_form', 'flatsome_woocommerce_after_add_to_cart_form');
function flatsome_woocommerce_after_add_to_cart_form(){
echo do_shortcode('[slw_product_locations show_qty="yes" show_stock_status="no" show_empty_stock="yes" collapsed="no" stock_location_status="enabled"]');
}