Woocommerce filter by floor dimensions (width*length) in products page?WooCommerce - get category for product pageWordpress query - Order by meta-field valueWordPress WP_Query: Display custom post type based on custom meta value, and also order on another custom meta valueAdd In Text/HTML After Woocommerce Product Page Descriptionhow woocommerce product get order by product tagHow to display all orders for a single product showing the most recent first? WoocommerceWoocommerce override Product Price with custom value on cart and checkoutChange the Product dimensions order in WooCommerce single product pagesRandomize WooCommerce “Shop By Category”WooCommerce order variation products by price
How quality assurance engineers test calculations?
Why weren't bootable game disks ever a thing on the IBM PC?
The three greedy pirates
How do we handle pauses in a dialogue?
What would +1/+2/+3 items be called in game?
Can I play a mimic PC?
What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?
Can i use larger/smaller circular saw blades on my circular / plunge / table / miter saw?
Party going through airport security at separate times?
Reverse dots and boxes
Does a wizard need their hands free in order to cause their familiar from the Find Familiar spell to reappear?
What is the correct parsing of お高くとまる?
Why did Harry Potter get a bedroom?
How can a dictatorship government be beneficial to a dictator in a post-scarcity society?
Having decision making power over someone's assets
Addressing unnecessary daily meetings with manager?
Data Encryption by Application vs Data Encryption in Database
What are the original Russian words for a prostitute?
What attributes and how big would a sea creature(s) need to be able to tow a ship?
How to drill holes in 3/8" steel plates?
LED glows slightly during soldering
Integer Lists of Noah
Why does the Antonov AN-225 not have any winglets?
Misrepresented my work history
Woocommerce filter by floor dimensions (width*length) in products page?
WooCommerce - get category for product pageWordpress query - Order by meta-field valueWordPress WP_Query: Display custom post type based on custom meta value, and also order on another custom meta valueAdd In Text/HTML After Woocommerce Product Page Descriptionhow woocommerce product get order by product tagHow to display all orders for a single product showing the most recent first? WoocommerceWoocommerce override Product Price with custom value on cart and checkoutChange the Product dimensions order in WooCommerce single product pagesRandomize WooCommerce “Shop By Category”WooCommerce order variation products by price
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to create a custom filter for product dimensions in Woocommerce products page. I can't find a way to do any math to accomplish filtering based on floor dimensions (width*length).
function woocommerce_catalog_orderby( $orderby )
$orderby['heaviest'] = __( 'Heaviest first', 'woocommerce' );
$orderby['lightest'] = __( 'Lightest first', 'woocommerce' );
$orderby['biggest'] = __( 'Biggest first', 'woocommerce' );
return $orderby;
add_filter( "woocommerce_catalog_orderby", "woocommerce_catalog_orderby", 20 );
function woocommerce_get_catalog_ordering_args( $args )
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'heaviest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
if ( 'lightest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'ASC';
if ( 'biggest' == $orderby_value )
$math='_length' * '_width';
$args['meta_key'] = $math;
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
return $args;
add_filter( 'woocommerce_get_catalog_ordering_args', 'woocommerce_get_catalog_ordering_args', 20 );
php wordpress woocommerce
add a comment |
I'm trying to create a custom filter for product dimensions in Woocommerce products page. I can't find a way to do any math to accomplish filtering based on floor dimensions (width*length).
function woocommerce_catalog_orderby( $orderby )
$orderby['heaviest'] = __( 'Heaviest first', 'woocommerce' );
$orderby['lightest'] = __( 'Lightest first', 'woocommerce' );
$orderby['biggest'] = __( 'Biggest first', 'woocommerce' );
return $orderby;
add_filter( "woocommerce_catalog_orderby", "woocommerce_catalog_orderby", 20 );
function woocommerce_get_catalog_ordering_args( $args )
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'heaviest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
if ( 'lightest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'ASC';
if ( 'biggest' == $orderby_value )
$math='_length' * '_width';
$args['meta_key'] = $math;
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
return $args;
add_filter( 'woocommerce_get_catalog_ordering_args', 'woocommerce_get_catalog_ordering_args', 20 );
php wordpress woocommerce
This is not possible this way… You should need to save on database for each product a custom field (custom meta data) which value is the result of from product length x product width.
– LoicTheAztec
Mar 26 at 1:51
add a comment |
I'm trying to create a custom filter for product dimensions in Woocommerce products page. I can't find a way to do any math to accomplish filtering based on floor dimensions (width*length).
function woocommerce_catalog_orderby( $orderby )
$orderby['heaviest'] = __( 'Heaviest first', 'woocommerce' );
$orderby['lightest'] = __( 'Lightest first', 'woocommerce' );
$orderby['biggest'] = __( 'Biggest first', 'woocommerce' );
return $orderby;
add_filter( "woocommerce_catalog_orderby", "woocommerce_catalog_orderby", 20 );
function woocommerce_get_catalog_ordering_args( $args )
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'heaviest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
if ( 'lightest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'ASC';
if ( 'biggest' == $orderby_value )
$math='_length' * '_width';
$args['meta_key'] = $math;
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
return $args;
add_filter( 'woocommerce_get_catalog_ordering_args', 'woocommerce_get_catalog_ordering_args', 20 );
php wordpress woocommerce
I'm trying to create a custom filter for product dimensions in Woocommerce products page. I can't find a way to do any math to accomplish filtering based on floor dimensions (width*length).
function woocommerce_catalog_orderby( $orderby )
$orderby['heaviest'] = __( 'Heaviest first', 'woocommerce' );
$orderby['lightest'] = __( 'Lightest first', 'woocommerce' );
$orderby['biggest'] = __( 'Biggest first', 'woocommerce' );
return $orderby;
add_filter( "woocommerce_catalog_orderby", "woocommerce_catalog_orderby", 20 );
function woocommerce_get_catalog_ordering_args( $args )
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'heaviest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
if ( 'lightest' == $orderby_value )
$args['meta_key'] = '_weight';
$args['orderby'] = 'meta_value_num';
$args['order'] = 'ASC';
if ( 'biggest' == $orderby_value )
$math='_length' * '_width';
$args['meta_key'] = $math;
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
return $args;
add_filter( 'woocommerce_get_catalog_ordering_args', 'woocommerce_get_catalog_ordering_args', 20 );
php wordpress woocommerce
php wordpress woocommerce
asked Mar 26 at 0:34
FerallenFerallen
133 bronze badges
133 bronze badges
This is not possible this way… You should need to save on database for each product a custom field (custom meta data) which value is the result of from product length x product width.
– LoicTheAztec
Mar 26 at 1:51
add a comment |
This is not possible this way… You should need to save on database for each product a custom field (custom meta data) which value is the result of from product length x product width.
– LoicTheAztec
Mar 26 at 1:51
This is not possible this way… You should need to save on database for each product a custom field (custom meta data) which value is the result of from product length x product width.
– LoicTheAztec
Mar 26 at 1:51
This is not possible this way… You should need to save on database for each product a custom field (custom meta data) which value is the result of from product length x product width.
– LoicTheAztec
Mar 26 at 1:51
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348271%2fwoocommerce-filter-by-floor-dimensions-widthlength-in-products-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348271%2fwoocommerce-filter-by-floor-dimensions-widthlength-in-products-page%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This is not possible this way… You should need to save on database for each product a custom field (custom meta data) which value is the result of from product length x product width.
– LoicTheAztec
Mar 26 at 1:51