• Resolved rokaklih

    (@rokaklih)


    Hello!

    The problem I’m currently facing with is that with the code below (“My code“) and it won’t sort my products on the home page, by custom field “price“. References -> click here.

    I would like to have first products to be sorted by date, and second one by price.

    My code:

    add_filter( 'woocommerce_shortcode_products_query', 'woocommerce_shortcode_products_orderby' );
    
    function woocommerce_shortcode_products_orderby( $args ) {
    
        $standard_array = array('menu_order','title','date','rand','id');
    
        if( isset( $args['orderby'] ) && !in_array( $args['orderby'], $standard_array ) ) {
            $args['price'] = $args['orderby'];
            $args['orderby']  = 'meta_value_num'; 
        }
    
        return $args;
    }

    On the front page I have 2 products shortcode:

    [products limit="12" columns="12"  orderby="date" order="DESC"  ]
    
    AND
    
    //this are the products, that I would like to sort by //custom field price
    [products limit="12" columns="12"  orderby="price" order="desc"  ]

    The result on the home page, the look excatly the same, you can see it on the image down below.

    Can someone help me out please?

    Best regards!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    To check better into this, can you please share a copy of your site’s System Status Report? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.?

    Thanks.

    Thread Starter rokaklih

    (@rokaklih)

    Hi Igor,

    of course.

    `
    ### WordPress Environment ###
    
    WordPress address (URL): https://clone.mita.si
    Site address (URL): https://clone.mita.si
    WC Version: 7.3.0
    REST API Version: ?</img> 7.3.0
    WC Blocks Version: ?</img> 9.1.5
    Action Scheduler Version: ?</img> 3.5.3
    Log Directory Writable: ?</img>
    WP Version: 6.1.1
    WP Multisite: –
    WP Memory Limit: 512 MB
    WP Debug Mode: –
    WP Cron: ?</img>
    Language: sl_SI
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: LiteSpeed
    PHP Version: 7.4.33
    PHP Post Max Size: 8 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.29.0
    NSS/3.53.1
    
    SUHOSIN Installed: –
    MySQL Version: 5.5.5-10.6.11-MariaDB-log
    Max Upload Size: 8 MB
    Default Timezone is UTC: ?</img>
    fsockopen/cURL: ?</img>
    SoapClient: ?</img>
    DOMDocument: ?</img>
    GZip: ?</img>
    Multibyte String: ?</img>
    Remote Post: ?</img>
    Remote Get: ?</img>
    
    ### Database ###
    
    WC Database Version: 7.1.0
    WC Database Prefix: wpe0_
    Skupna velikost podatkovne zbirke: 2380.62MB
    Velikost podatkov podatkovne zbirke: 1543.60MB
    Velikost kazala podatkovne zbirke: 837.02MB
    wpe0_woocommerce_sessions: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_woocommerce_api_keys: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_woocommerce_attribute_taxonomies: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_woocommerce_downloadable_product_permissions: Podatki: 0.02 MB + Kazalo: 0.06 MB + Pogon InnoDB
    wpe0_woocommerce_order_items: Podatki: 45.58 MB + Kazalo: 14.55 MB + Pogon InnoDB
    wpe0_woocommerce_order_itemmeta: Podatki: 333.91 MB + Kazalo: 373.91 MB + Pogon InnoDB
    wpe0_woocommerce_tax_rates: Podatki: 0.02 MB + Kazalo: 0.06 MB + Pogon InnoDB
    wpe0_woocommerce_tax_rate_locations: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_woocommerce_shipping_zones: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_woocommerce_shipping_zone_locations: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_woocommerce_shipping_zone_methods: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_woocommerce_payment_tokens: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_woocommerce_payment_tokenmeta: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_woocommerce_log: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    plt_db_pool: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    plt_item_simple: Podatki: 0.06 MB + Kazalo: 0.03 MB + Pogon InnoDB
    plt_log: Podatki: 123.66 MB + Kazalo: 0.00 MB + Pogon InnoDB
    plt_price: Podatki: 1.52 MB + Kazalo: 0.31 MB + Pogon InnoDB
    plt_price_tmp: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    plt_settings: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    plt_stock: Podatki: 1.52 MB + Kazalo: 0.23 MB + Pogon InnoDB
    plt_stock_tmp: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    plt_sync_item: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    plt_sync_item_tmp: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    plt_sync_item_to_erp: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    plt_sync_order_status: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    plv_item_simple: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    plv_order: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    plv_order_item: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    plv_order_item_user: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    plv_order_trans: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    plv_order_user: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    plv_pay_method: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    plv_shipping_method: Podatki: 0.00 MB + Kazalo: 0.00 MB + Pogon
    wpe0_actionscheduler_actions: Podatki: 7.02 MB + Kazalo: 16.27 MB + Pogon InnoDB
    wpe0_actionscheduler_claims: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_actionscheduler_groups: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_actionscheduler_logs: Podatki: 5.02 MB + Kazalo: 6.03 MB + Pogon InnoDB
    wpe0_alm: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_berocket_termmeta: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_cartbounty_pro: Podatki: 55.59 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_cartbounty_pro_coupons: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_cartbounty_pro_products: Podatki: 0.14 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_cli_cookie_scan: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_cli_cookie_scan_categories: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_cli_cookie_scan_cookies: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_cli_cookie_scan_url: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_cli_scripts: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_commentmeta: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_comments: Podatki: 57.59 MB + Kazalo: 22.92 MB + Pogon InnoDB
    wpe0_ewd_uwpm_email_links_clicked_events: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_ewd_uwpm_email_only_users: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_ewd_uwpm_email_open_events: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_ewd_uwpm_email_send_events: Podatki: 0.05 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_e_events: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_e_notes: Podatki: 0.02 MB + Kazalo: 0.17 MB + Pogon InnoDB
    wpe0_e_notes_users_relations: Podatki: 0.02 MB + Kazalo: 0.05 MB + Pogon InnoDB
    wpe0_e_submissions: Podatki: 1.52 MB + Kazalo: 1.95 MB + Pogon InnoDB
    wpe0_e_submissions_actions_log: Podatki: 0.28 MB + Kazalo: 0.56 MB + Pogon InnoDB
    wpe0_e_submissions_values: Podatki: 0.36 MB + Kazalo: 0.33 MB + Pogon InnoDB
    wpe0_gglcptch_allowlist: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_jet_post_types: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_jet_taxonomies: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_links: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_litespeed_crawler: Podatki: 0.08 MB + Kazalo: 0.08 MB + Pogon InnoDB
    wpe0_litespeed_crawler_blacklist: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_litespeed_img_optm: Podatki: 1.52 MB + Kazalo: 0.72 MB + Pogon InnoDB
    wpe0_litespeed_img_optming: Podatki: 0.02 MB + Kazalo: 0.05 MB + Pogon InnoDB
    wpe0_litespeed_url: Podatki: 0.38 MB + Kazalo: 0.58 MB + Pogon InnoDB
    wpe0_litespeed_url_file: Podatki: 0.06 MB + Kazalo: 0.08 MB + Pogon InnoDB
    wpe0_mailchimp_carts: Podatki: 5.52 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_mailchimp_jobs: Podatki: 0.39 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_omnisend_logs: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_options: Podatki: 123.33 MB + Kazalo: 0.27 MB + Pogon InnoDB
    wpe0_pmxe_exports: Podatki: 2.52 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxe_google_cats: Podatki: 0.39 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxe_posts: Podatki: 4.52 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxe_templates: Podatki: 0.20 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxi_files: Podatki: 0.06 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxi_hash: Podatki: 0.42 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxi_history: Podatki: 0.05 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxi_images: Podatki: 0.19 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxi_imports: Podatki: 5.52 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxi_posts: Podatki: 3.52 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_pmxi_templates: Podatki: 1.52 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_postexpirator_debug: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_postmeta: Podatki: 647.81 MB + Kazalo: 296.33 MB + Pogon InnoDB
    wpe0_posts: Podatki: 20.08 MB + Kazalo: 10.06 MB + Pogon InnoDB
    wpe0_rank_math_analytics_keyword_manager: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_rank_math_analytics_objects: Podatki: 0.08 MB + Kazalo: 0.05 MB + Pogon InnoDB
    wpe0_rank_math_internal_links: Podatki: 0.09 MB + Kazalo: 0.05 MB + Pogon InnoDB
    wpe0_rank_math_internal_meta: Podatki: 0.34 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_rank_math_redirections: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_rank_math_redirections_cache: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_redirection_404: Podatki: 0.02 MB + Kazalo: 0.05 MB + Pogon InnoDB
    wpe0_redirection_groups: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_redirection_items: Podatki: 0.02 MB + Kazalo: 0.09 MB + Pogon InnoDB
    wpe0_redirection_logs: Podatki: 0.02 MB + Kazalo: 0.05 MB + Pogon InnoDB
    wpe0_revslider_css: Podatki: 0.13 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_revslider_css_bkp: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_revslider_layer_animations: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_revslider_layer_animations_bkp: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_revslider_navigations: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_revslider_navigations_bkp: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_revslider_sliders: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_revslider_sliders_bkp: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_revslider_slides: Podatki: 0.34 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_revslider_slides_bkp: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_revslider_static_slides: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_revslider_static_slides_bkp: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_shortpixel_folders: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_shortpixel_meta: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_termmeta: Podatki: 0.11 MB + Kazalo: 0.14 MB + Pogon InnoDB
    wpe0_terms: Podatki: 0.05 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_term_relationships: Podatki: 0.47 MB + Kazalo: 0.41 MB + Pogon InnoDB
    wpe0_term_taxonomy: Podatki: 0.06 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_tm_taskmeta: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_tm_tasks: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_usermeta: Podatki: 14.52 MB + Kazalo: 14.03 MB + Pogon InnoDB
    wpe0_users: Podatki: 1.52 MB + Kazalo: 0.77 MB + Pogon InnoDB
    wpe0_wc_admin_notes: Podatki: 0.05 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_wc_admin_note_actions: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_wc_category_lookup: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_wc_customer_lookup: Podatki: 2.52 MB + Kazalo: 1.97 MB + Pogon InnoDB
    wpe0_wc_download_log: Podatki: 0.02 MB + Kazalo: 0.03 MB + Pogon InnoDB
    wpe0_wc_order_coupon_lookup: Podatki: 0.06 MB + Kazalo: 0.06 MB + Pogon InnoDB
    wpe0_wc_order_product_lookup: Podatki: 57.59 MB + Kazalo: 62.19 MB + Pogon InnoDB
    wpe0_wc_order_stats: Podatki: 4.52 MB + Kazalo: 4.55 MB + Pogon InnoDB
    wpe0_wc_order_tax_lookup: Podatki: 5.52 MB + Kazalo: 5.03 MB + Pogon InnoDB
    wpe0_wc_product_attributes_lookup: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_wc_product_download_directories: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_wc_product_meta_lookup: Podatki: 0.44 MB + Kazalo: 0.77 MB + Pogon InnoDB
    wpe0_wc_rate_limits: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_wc_reserved_stock: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_wc_tax_rate_classes: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_wc_webhooks: Podatki: 0.02 MB + Kazalo: 0.02 MB + Pogon InnoDB
    wpe0_wpfm_backup: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_wpmailsmtp_debug_events: Podatki: 1.52 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_wpmailsmtp_tasks_meta: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_wpml_mails: Podatki: 0.19 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_wt_sc_coupon_lookup: Podatki: 0.02 MB + Kazalo: 0.00 MB + Pogon InnoDB
    wpe0_zorem_email_sms_log: Podatki: 0.02 MB + Kazalo: 0.11 MB + Pogon InnoDB
    
    ### Post Type Counts ###
    
    attachment: 3206
    br_labels: 2
    cookielawinfo: 12
    custom_css: 1
    elementor_library: 126
    elementor_snippet: 19
    jet-engine: 1
    jet-menu: 4
    jet-smart-filters: 2
    jet-woo-builder: 18
    nav_menu_item: 410
    page: 16
    post: 2
    product: 434
    product_variation: 10
    revision: 127
    shop_coupon: 15
    shop_order: 40240
    user_request: 1
    uwpm_email_log: 201
    uwpm_mail_template: 1
    wc_order_email: 1
    wc_order_status: 9
    woo_mb_template: 13
    wp_global_styles: 1
    
    ### Security ###
    
    Secure connection (HTTPS): ?</img>
    Hide errors from visitors: ?</img>
    
    ### Active Plugins (28) ###
    
    WooCommerce Advanced Product Labels: od BeRocket – 1.2.4.1
    Custom Order Numbers for WooCommerce: od Tyche Softwares – 1.4.0
    Disable Cart Fragments: od Optimocha – 2.2
    Elementor Pro: od Elementor.com – 3.7.1
    Elementor: od Elementor.com – 3.7.1
    Facebook for WooCommerce: od Facebook – 3.0.8
    reCaptcha by BestWebSoft: od BestWebSoft – 1.70
    JetBlocks For Elementor: od Crocoblock – 1.3.5
    JetElements For Elementor: od Crocoblock – 2.6.8
    JetEngine: od Crocoblock – 3.1.0
    JetSearch: od Crocoblock – 3.0.3
    JetTabs For Elementor: od Crocoblock – 2.1.20
    WooCommerce Load More Products: od BeRocket – 1.1.9.8
    Mailchimp for WooCommerce: od Mailchimp – 2.7.6
    No password notification: od AKLIH – 1.0
    PublishPress Future: od PublishPress – 2.8.3
    Qty Increment Buttons for WooCommerce: od taisho – 2.7.5
    Rank Math SEO PRO: od Rank Math – 3.0.26.1
    Rank Math SEO: od Rank Math – 1.0.106
    WooCommerce Dynamic Pricing & Discounts: od RightPress – 2.3.3
    Checkout Field Editor for WooCommerce: od ThemeHigh – 1.8.1
    CartBounty Pro - Save and recover abandoned carts for WooCommerce: od Streamline.lv – 9.9.1.2
    Braintree za WooCommerce pla?ilni prehod: od Woocommerce – 2.9.1
    WooCommerce Google Analytics Integration: od WooCommerce – 1.5.19
    WooCommerce Order Status Manager: od SkyVerge – 1.13.4
    WooCommerce: od Automattic – 7.3.0
    WooCommerce Email Customizer with Drag and Drop Email Builder: od Flycart Technologies LLP – 1.5.16
    WP Mail SMTP: od WPForms – 3.7.0
    
    ### Inactive Plugins (12) ###
    
    CookieYes | GDPR Cookie Consent: od CookieYes – 3.0.8
    Jetpack: od Automattic – 11.7.1
    LiteSpeed Cache: od LiteSpeed Technologies – 5.3.2
    Redirection: od John Godley – 5.3.8
    Side Cart WooCommerce: od XootiX – 2.1
    WooCommerce Free Gift Coupons: od Kathy Darling – 2.4.2
    WooCommerce GLS Print Label: od Lumen Spei – 4.1.0
    WooCommerce GLS Print Label: od Krunoslav Ris – 3.953
    WP All Export - WooCommerce Export Add-On Pro: od Soflyy – 1.0.5
    WP All Export Pro: od Soflyy – 1.8.1
    WP All Import - WooCommerce Import Add-On Pro: od Soflyy – 3.3.4
    WP All Import Pro: od Soflyy – 4.7.8
    
    ### Dropin Plugins (1) ###
    
    advanced-cache.php: advanced-cache.php
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: EUR (€)
    Currency Position: right_space
    Thousand Separator: .
    Decimal Separator: ,
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: –
    Enforce Approved Product Download Directories: –
    Order datastore: WC_Order_Data_Store_CPT
    
    ### WC Pages ###
    
    Osnova trgovine: #12 - /trgovina/
    Ko?arica: #13 - /kosarica/
    Zaklju?ek nakupa: #14 - /zakljucek-nakupa/
    Moj ra?un: #15 - /moj-racun/
    Pogoji poslovanja: #2788 - /pogoji-poslovanja/
    
    ### Theme ###
    
    Name: Hello Elementor Child
    Version: 1.0.1
    Author URL: https://elementor.com/
    Child Theme: ?</img>
    Parent Theme Name: Hello Elementor
    Parent Theme Version: 2.6.1
    Parent Theme Author URL: https://elementor.com/?utm_source=wp-themes&utm_campaign=author-uri&utm_medium=wp-dash
    WooCommerce Support: ?</img>
    
    ### Templates ###
    
    Overrides: hello-theme-child-master/woocommerce/archive-product.php
    hello-theme-child-master/woocommerce/content-product.php
    hello-theme-child-master/woocommerce/single-product/price.php
    
    
    ### Braintree (kreditna kartica) ###
    
    Environment: Proizvodnja
    Tokenization Enabled: –
    Debug Mode: Off
    
    ### Braintree (PayPal) ###
    
    Environment: Proizvodnja
    Tokenization Enabled: –
    Debug Mode: Off
    
    ### Admin ###
    
    Enabled Features: activity-panels
    analytics
    coupons
    customer-effort-score-tracks
    experimental-products-task
    experimental-import-products-task
    experimental-fashion-sample-products
    shipping-smart-defaults
    shipping-setting-tour
    homescreen
    marketing
    multichannel-marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    woo-mobile-welcome
    wc-pay-promotion
    wc-pay-welcome-page
    
    Disabled Features: minified-js
    new-product-management-experience
    settings
    
    Daily Cron: ?</img> Next scheduled: 2023-01-24 06:34:51 +01:00
    Options: ?</img>
    Notes: 29
    Onboarding: completed
    
    ### Action Scheduler ###
    
    Canceled: 310
    Oldest: 2022-12-23 22:10:07 +0100
    Newest: 2023-01-11 10:00:12 +0100
    
    Complete: 18.844
    Oldest: 2022-12-24 10:15:15 +0100
    Newest: 2023-01-23 13:33:07 +0100
    
    Failed: 19
    Oldest: 2022-01-21 19:39:29 +0100
    Newest: 2023-01-23 13:07:47 +0100
    
    In-progress: 1
    Oldest: –
    Newest: –
    
    Pending: 3
    Oldest: 2023-01-23 14:39:48 +0100
    Newest: 2023-01-27 20:29:12 +0100
    
    
    ### Status report information ###
    
    Generated at: 2023-01-23 13:33:59 +01:00
    `

    Best regards!

    Howdy @rokaklih

    Just to note, packaged with WooCommerce come the WooCommerce Blocks.

    Therefore, my suggestion is to go ahead with checking out the:

    Feel free to check out the WooCommerce Blocks feature plugin further, via the link here.

    I trust that points you in the right direction, but if you have more questions, let us know. We’re happy to help.

    • This reply was modified 1 year, 10 months ago by anastas10s. Reason: added plugin link
    Thread Starter rokaklih

    (@rokaklih)

    Hi @anastas10s,

    If I understand Woocommerce Blocks the right way, I have to build page in wordpress editor like you can see it on the image below.

    But that is not what I’m looking for. What I’m trying to achieve is to sort products by custom field (dicsount, price, sales etc.). You can see it on the code down below, that I’m trying to orderby discount.

    [products limit="12" columns="12"  orderby="discount" order="desc"  ]

    So I think your solution won’t help me in my case.

    Maybe you are wondering why I just won’t add the Woocommerce blocks, right? Because I’m trying to optimize website, to the lowest plugins possible. That’s why I want to sort products by custom field, that are displayed only by shortcode.

    Hi there @rokaklih

    Thank you for reaching back, clarifying things further.

    What I’m trying to achieve is to sort products by custom field (dicsount, price, sales etc.)

    For that, feel free to check out the On Sale Products block, instead, which offers these sorting and display options, as showcased here.

    Maybe you are wondering why I just won’t add the Woocommerce blocks, right? Because I’m trying to optimize website, to the lowest plugins possible.

    To clarify, WooCommerce Blocks are part of the core WooCommerce plugin, therefore no extra plugins are necessary.

    The difference is that with WooCommerce version: 7.3.0, comes included WooCommerce Blocks package: 9.1.5; while, if adding the plugin as a standalone, version 9.4.1 is its current latest.

    I trust that clarifies things further, but if you have more questions, let us know. We’re happy to help.

    • This reply was modified 1 year, 10 months ago by anastas10s. Reason: further clarified WooCommerce Blocks versions
    Thread Starter rokaklih

    (@rokaklih)

    Hi again @anastas10s,

    Firstly of all thanks a lot for your time and help. And I do understand that Woocommecre blocks are included, and that I can sort products by newesest, price and sales. And If I use woocommerce blocks is it possible to get shortcode of the products showcase?

    Secondly I still think that you don’t understand me to the fullest, it might be my bad in clearfiying.

    I want to sort products by custom field, which I have added to each product. The custom field contains discount of each product so E.G. if product’s regular price is 50 and sale price is 25, the custom field discount has the value of “-0,50”. And I want to sort products by custom field discount. I know that this is possible on shop page, because I already have it sorted in that way, but I don’t know how I can sort products using shortcode ” [products limit=”12″ columns=”12″ orderby=”discount” order=”desc” ]” by “discount”?

    I hope it makes sense.:)

    Best regards!

    Hi @rokaklih

    I want to sort products by custom field, which I have added to each product. The custom field contains discount of each product so E.G. if product’s regular price is 50 and sale price is 25, the custom field discount has the value of “-0,50”. And I want to sort products by custom field discount. I know that this is possible on shop page, because I already have it sorted in that way, but I don’t know how I can sort products using shortcode ” [products limit=”12″ columns=”12″ orderby=”discount” order=”desc” ]” by “discount”?

    Thank you for providing further information about your inquiry here. Going back to your original post, I understand that you are referring to this documentation about Sorting Products by Custom Meta Fields

    If I understand you correctly, you want to sort your products on the Shop Page by price and discount, right? Sorting by price is already working, but sorting by discount is not, correct?

    This is a fairly complex development topic that would require customization to do it. Since custom coding is outside our scope of support, I am leaving this thread open for a bit to see if anyone can chime in to help you out.

    For questions related to development and custom coding, your best bet is to ask on any of these channels for support. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, too.

    Hope this helps!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Sort products by custom field – won’t work’ is closed to new replies.