Skip to content

Commit 37f0060

Browse files
mjoslynclaude
andcommitted
Fix flowchart headline: pass empty base to effective_price
v0.5.6 routed the flowchart headline through effective_price but handed it the regular base meta value, which the engine uses as-is and so never applies a storewide/bundle sale (showed 3795 instead of the 3195 the customer pays). Pass an empty base so the engine derives the active price from the product. Verified: the rendered headline now shows the sale price with the regular struck through. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8252882 commit 37f0060

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/Flowchart/Flowchart.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,11 @@ private function render_page( $product_id, $user_id = 0 ) {
691691
if ( $as_user ) :
692692
$base = (float) get_post_meta( $product_id, $this->config->base_meta()['regular'], true );
693693
$u_reg = $this->engine->price_for_user( $base, $product, $user_id, false );
694-
// What the customer actually pays: the effective (sale-applied) price,
695-
// not the regular tier price. price_for_user( ..., true ) alone is fed the
696-
// regular base and misses a storewide/bundle sale; effective_price resolves it.
697-
$paid = $this->engine->effective_price( $base, $product, $user_id );
694+
// What the customer actually pays: the effective (sale-applied) price.
695+
// Pass an EMPTY base so the engine derives the active price from the
696+
// product (including a storewide/bundle sale). Passing the regular base
697+
// here suppresses the sale — the engine uses the value it's handed.
698+
$paid = $this->engine->effective_price( '', $product, $user_id );
698699
$priced_as = $this->context->resolve_pricing_user_id( (int) $user_id );
699700
$parent = ( $priced_as !== (int) $user_id ) ? get_userdata( $priced_as ) : null;
700701
$role_user = $parent ? $parent : $as_user;

0 commit comments

Comments
 (0)