8000 ISBAT to fetch products by ORDERBY query for `rand` · Issue #516 · co-cart/co-cart · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
ISBAT to fetch products by ORDERBY query for rand #516
Closed
@seb86

Description

@seb86

Describe the bug

Being able to order products by orderby parameter for rand was missing.

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest trunk branch of CoCart on GitHub.
  • The issue still exists against the latest development branch of CoCart on GitHub (this is not the same version as on WordPress.org!).
  • I have attempted to find the simplest possible steps to reproduce the issue.

Steps to reproduce the issue

  1. Make a request wp-json/cocart/v2/products?orderby=rand
  2. Response returns a 400 error - see response below.
{
    "code": "rest_invalid_param",
    "message": "Invalid parameter(s): orderby",
    "data": {
        "status": 400,
        "params": {
            "orderby": "orderby is not one of date, id, menu_order, include, title, slug, name, popularity, alphabetical, reverse_alpha, by_stock, review_count, on_sale_first, featured_first, price_asc, price_desc, sales, and rating."
        },
        "details": {
            "orderby": {
                "code": "rest_not_in_enum",
                "message": "orderby is not one of date, id, menu_order, include, title, slug, name, popularity, alphabetical, reverse_alpha, by_stock, review_count, on_sale_first, featured_first, price_asc, price_desc, sales, and rating.",
                "data": null
            }
        }
    }
}

Expected/actual behavior

I was expecting to see products returned at random.

Isolating the problem

  • This bug happens with only WooCommerce and CoCart plugin are active.
  • This bug happens with a default WordPress theme active.
  • This bug happens with the WordPress theme Storefront active.
  • This bug happens with the latest release of WooCommerce active.
  • This bug happens only when I authenticate as a customer.
  • This bug happens only when I authenticate as administrator.
  • I can reproduce this bug consistently using the steps above.

Metadata

Metadata

Assignees

Labels

focus: products APIThis issue/PR is related to the products API.priority: highThe issue/PR is high priority—it affects lots of customers substantially, but not critically.status:approvedPRs that have been approved and ready to be merged.status:changelog addedMark all PRs that have their changelog entries added to CHANGELOG.mdtype: bugThe issue is a confirmed bug.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0