Sort variants by price in configurable product in API
-
How can I Sort variants by price in the configurable product in API?
-
Hi @AkashWeybee,
This is customization, I can only help you with the code rest you need to do it at your end.
These variants are coming from here,
https://github.com/bagisto/bagisto/blob/5a4ea8db9c5ef6eb784365a8dc3aac6dba7c09ee/packages/Webkul/API/Http/Resources/Catalog/Product.php#L219You need to create one more method in the model let's say
variantsByPriceOrder
which will retrieve based on the price, then call it,return [ 'variants' => $product->variantsByPriceOrder ];
-
@devansh-webkul Thank you, sir!