• Resolved alb76

    (@alberto76)


    I would like to know how it manages the sorting of products with the same name, if I have several products that are called for example ‘cactus mix’, when I sort by name what is the parameter with which they are sorted first one than the other?

    thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • Vijay Hardaha

    (@vijayhardaha)

    ID will be used if the product name is the same.

    Hi @alberto76!

    As @vijayhardaha already stated, if various products share the same name, they will be sorted according to their Product ID.

    The system generates a Product ID whenever you create a product, and you can find it in the Products section under the name of the product.

    More about it here: https://woocommerce.com/document/managing-products/#product-id.

    Cheers!

    Thread Starter alb76

    (@alberto76)

    Hi,

    thank you @vijayhardaha and @judagutor for your answer, I undestand, is it possible to create a code to say to order products by name and in case of equal name use a custom field that I put inside all products.

    Do you know any documentation about this?

    thank you

    Vijay Hardaha

    (@vijayhardaha)

    name for sorting will be used for database value. so if you’re using any filter to change the product title it won’t make any difference in sorting.

    Thread Starter alb76

    (@alberto76)

    I think I didn’t explain well, I would like to create a new kind of sorting, a function with two parameters, using name and for the products that have the same name a data specified in a custom field.

    Vijay Hardaha

    (@vijayhardaha)

    If you’re talking about sorting by meta value along with product title then you can set orderby like this

    'orderby' => 'title meta_value ',

    you can also use something like this 'orderby', array( 'title' => 'DESC' , 'meta_value' => 'DESC' )

    Thread Starter alb76

    (@alberto76)

    Thank you,

    with your suggestion I solved a part of proble.
    Now I need to study how take only number into meta_value, that it’s format from string+number.

    Mirko P.

    (@rainfallnixfig)

    Hey @alberto76

    Just to mention, if you do require more help with the actual coding, we’d recommend hiring a developer or one of the customization experts listed at https://woocommerce.com/customizations/.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘how woocommerce manages the sorting of products with the same name’ is closed to new replies.