Skip to content

Commit 100dfea

Browse files
committed
Removed the halfgram price in Flowers
1 parent ba82d67 commit 100dfea

4 files changed

+19
-31
lines changed

admin/post-types/wp-dispensary-metaboxes.php

-6
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ function wpdispensary_prices() {
163163
wp_create_nonce( plugin_basename( __FILE__ ) ) . '" />';
164164

165165
/** Get the prices data if its already been entered */
166-
$halfgram = get_post_meta( $post->ID, '_halfgram', true );
167166
$gram = get_post_meta( $post->ID, '_gram', true );
168167
$eighth = get_post_meta( $post->ID, '_eighth', true );
169168
$quarter = get_post_meta( $post->ID, '_quarter', true );
@@ -172,10 +171,6 @@ function wpdispensary_prices() {
172171

173172
/** Echo out the fields */
174173
echo '<div class="pricebox">';
175-
echo '<p>1/2 Gram:</p>';
176-
echo '<input type="text" name="_halfgram" value="' . $halfgram . '" class="widefat" />';
177-
echo '</div>';
178-
echo '<div class="pricebox">';
179174
echo '<p>Gram:</p>';
180175
echo '<input type="text" name="_gram" value="' . $gram . '" class="widefat" />';
181176
echo '</div>';
@@ -221,7 +216,6 @@ function wpdispensary_save_prices_meta( $post_id, $post ) {
221216
* We'll put it into an array to make it easier to loop though.
222217
*/
223218

224-
$prices_meta['_halfgram'] = $_POST['_halfgram'];
225219
$prices_meta['_gram'] = $_POST['_gram'];
226220
$prices_meta['_eighth'] = $_POST['_eighth'];
227221
$prices_meta['_quarter'] = $_POST['_quarter'];

admin/wp-dispensary-data-output.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ function wpd_data_output_content( $content ) {
567567
}
568568

569569
if ( in_array( get_post_type(), array( 'flowers' ) ) ) {
570-
$content .= '<tr>' . $wpdhalfgram . $wpdgram . $wpdeighth . $wpdquarter . $wpdhalfounce . $wpdounce . '</tr>';
570+
$content .= '<tr>' . $wpdgram . $wpdeighth . $wpdquarter . $wpdhalfounce . $wpdounce . '</tr>';
571571
}
572572

573573
if ( in_array( get_post_type(), array( 'concentrates' ) ) ) {

admin/wp-dispensary-rest-api.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function topicals_category( $data, $post, $request ) {
274274
* Registering Prices
275275
*/
276276
function slug_register_prices() {
277-
$productsizes = array( '_halfgram', '_gram', '_eighth', '_quarter', '_halfounce', '_ounce' );
277+
$productsizes = array( '_gram', '_eighth', '_quarter', '_halfounce', '_ounce' );
278278
foreach ( $productsizes as $size ) {
279279
register_rest_field(
280280
array( 'flowers' ),

admin/wp-dispensary-shortcodes.php

+17-23
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ function wpdispensary_flowers_shortcode( $atts ) {
125125

126126
/** Get the pricing for Flowers */
127127

128-
$priceHalfGram = get_post_meta( get_the_ID(), '_halfgram', true );
129128
$priceGram = get_post_meta( get_the_ID(), '_gram', true );
130129
$priceEighth = get_post_meta( get_the_ID(), '_eighth', true );
131130
$priceQuarter = get_post_meta( get_the_ID(), '_quarter', true );
@@ -321,29 +320,25 @@ function wpdispensary_flowers_shortcode( $atts ) {
321320
'ZWL' => '&#90;&#36;',
322321
);
323322

324-
if ( '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
325-
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfgram', true ) . ' per half gram';
326-
} elseif ( '' === $priceHalfGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
323+
if ( '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
327324
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_gram', true ) . ' per gram';
328-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
325+
} elseif ( '' === $priceGram && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
329326
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_eighth', true ) . ' per eighth';
330-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceEighth && '' === $priceHalfOunce && '' === $priceOunce ) {
327+
} elseif ( '' === $priceGram && '' === $priceEighth && '' === $priceHalfOunce && '' === $priceOunce ) {
331328
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_quarter', true ) . ' per quarter ounce';
332-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceOunce ) {
329+
} elseif ( '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceOunce ) {
333330
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfounce', true ) . ' per half ounce';
334-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce ) {
331+
} elseif ( '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce ) {
335332
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_ounce', true ) . ' per ounce';
336333
} else {
337334
$pricing = '';
338335
}
339336

340-
if ( '' === $priceHalfGram && '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
337+
if ( '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
341338
$pricing = ' ';
342339
}
343340

344-
if ( get_post_meta( get_the_ID(), '_halfgram', true ) ) {
345-
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfgram', true );
346-
} elseif ( get_post_meta( get_the_ID(), '_gram', true ) ) {
341+
if ( get_post_meta( get_the_ID(), '_gram', true ) ) {
347342
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_gram', true );
348343
} elseif ( get_post_meta( get_the_ID(), '_eighth', true ) ) {
349344
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_eighth', true );
@@ -352,7 +347,9 @@ function wpdispensary_flowers_shortcode( $atts ) {
352347
} elseif ( get_post_meta( get_the_ID(), '_halfounce', true ) ) {
353348
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfounce', true );
354349
}
350+
355351
$pricingsep = ' - ';
352+
356353
if ( get_post_meta( get_the_ID(), '_ounce', true ) ) {
357354
$pricinghigh = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_ounce', true );
358355
} elseif ( get_post_meta( get_the_ID(), '_halfounce', true ) ) {
@@ -2211,7 +2208,6 @@ function wpdispensary_carousel_shortcode( $atts ) {
22112208

22122209
/** Get the pricing for Flowers and Concentrates */
22132210

2214-
$priceHalfGram = get_post_meta( get_the_ID(), '_halfgram', true );
22152211
$priceGram = get_post_meta( get_the_ID(), '_gram', true );
22162212
$priceEighth = get_post_meta( get_the_ID(), '_eighth', true );
22172213
$priceQuarter = get_post_meta( get_the_ID(), '_quarter', true );
@@ -2407,25 +2403,21 @@ function wpdispensary_carousel_shortcode( $atts ) {
24072403
'ZWL' => '&#90;&#36;',
24082404
);
24092405

2410-
if ( '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
2411-
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfgram', true ) . ' per half gram';
2412-
} elseif ( '' === $priceHalfGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
2406+
if ( '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
24132407
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_gram', true ) . ' per gram';
2414-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
2408+
} elseif ( '' === $priceGram && '' === $priceQuarter && '' === $priceHalfOunce && '' === $priceOunce ) {
24152409
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_eighth', true ) . ' per eighth';
2416-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceEighth && '' === $priceHalfOunce && '' === $priceOunce ) {
2410+
} elseif ( '' === $priceGram && '' === $priceEighth && '' === $priceHalfOunce && '' === $priceOunce ) {
24172411
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_quarter', true ) . ' per quarter ounce';
2418-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceOunce ) {
2412+
} elseif ( '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceOunce ) {
24192413
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfounce', true ) . ' per half ounce';
2420-
} elseif ( '' === $priceHalfGram && '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce ) {
2414+
} elseif ( '' === $priceGram && '' === $priceEighth && '' === $priceQuarter && '' === $priceHalfOunce ) {
24212415
$pricing = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_ounce', true ) . ' per ounce';
24222416
} else {
24232417
$pricing = '';
24242418
}
24252419

2426-
if ( get_post_meta( get_the_ID(), '_halfgram', true ) ) {
2427-
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfgram', true );
2428-
} elseif ( get_post_meta( get_the_ID(), '_gram', true ) ) {
2420+
if ( get_post_meta( get_the_ID(), '_gram', true ) ) {
24292421
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_gram', true );
24302422
} elseif ( get_post_meta( get_the_ID(), '_eighth', true ) ) {
24312423
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_eighth', true );
@@ -2434,7 +2426,9 @@ function wpdispensary_carousel_shortcode( $atts ) {
24342426
} elseif ( get_post_meta( get_the_ID(), '_halfounce', true ) ) {
24352427
$pricinglow = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_halfounce', true );
24362428
}
2429+
24372430
$pricingsep = ' - ';
2431+
24382432
if ( get_post_meta( get_the_ID(), '_ounce', true ) ) {
24392433
$pricinghigh = $currency_symbols[ $wpd_currency ] . '' . get_post_meta( get_the_id(), '_ounce', true );
24402434
} elseif ( get_post_meta( get_the_ID(), '_halfounce', true ) ) {

0 commit comments

Comments
 (0)