• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups

Sort variants by price in configurable product in API

Bug Report
2
3
1.4k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    AkashWeybee last edited by 31 May 2021, 07:44

    How can I Sort variants by price in the configurable product in API?

    ea45270f-9dbf-4b41-b880-4b644a761a02-image.png

    1 Reply Last reply Reply Quote 0
    • devansh-webkul
      devansh-webkul last edited by 31 May 2021, 12:34

      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#L219

      You 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
      ];
      
      A 1 Reply Last reply 1 Jun 2021, 07:49 Reply Quote 0
      • A
        AkashWeybee @devansh-webkul last edited by 1 Jun 2021, 07:49

        @devansh-webkul Thank you, sir!

        1 Reply Last reply Reply Quote 0
        1 out of 3
        • First post
          1/3
          Last post