Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.8.4

- WooCommerce orders carry `order_id` and `placed_at`, so SendBeam stores each order once, attributes it to the email that led to it, and counts it in revenue. Orders reported by earlier versions cannot be attributed retroactively.

## 1.8.3

- Connect SendBeam: one button connects the site and hands it a key with exactly the permissions you tick, and can add your sending domain at the same time. Pasting a key by hand still works.
Expand Down
2 changes: 1 addition & 1 deletion blocks/form/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "sendbeam/form",
"version": "1.8.3",
"version": "1.8.4",
"title": "SendBeam Form",
"category": "widgets",
"icon": "email-alt",
Expand Down
2 changes: 1 addition & 1 deletion blocks/form/index.asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
// editor renders a placeholder card now. Loading a script nothing uses is
// how an editor gets slow one dependency at a time.
'dependencies' => array( 'wp-blocks', 'wp-element', 'wp-block-editor', 'wp-components', 'wp-i18n', 'wp-api-fetch' ),
'version' => '1.8.3',
'version' => '1.8.4',
);
13 changes: 10 additions & 3 deletions includes/ecommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,16 @@ function sendbeam_ecommerce_on_order_placed( $order_id ) {
'order_placed',
$email,
array(
'name' => trim( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() ),
'value' => (float) $order->get_total(),
'currency' => $order->get_currency(),
'name' => trim( $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() ),
'value' => (float) $order->get_total(),
'currency' => $order->get_currency(),
// The order id is what lets SendBeam store the order, attribute it
// to the email that led to it, and treat a retried delivery as the
// same order rather than a second one. Without it the event fires
// automations and moves lifetime value but appears in no revenue
// figure.
'order_id' => (string) $order->get_id(),
'placed_at' => $order->get_date_created() ? $order->get_date_created()->format( DATE_ATOM ) : gmdate( DATE_ATOM ),
)
);
}
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: newsletter, email marketing, signup form, popup, contact form
Requires at least: 6.1
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.8.3
Stable tag: 1.8.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -181,6 +181,9 @@ Yes. The form is an iframe and the pop-up is a script tag, both cache-safe.

== Changelog ==

= 1.8.4 =
* WooCommerce orders now carry the order number and the time it was placed, so SendBeam stores each order once, attributes it to the email that led to it, and counts it in revenue. Orders reported by earlier versions fired automations and lifetime value but cannot be attributed after the fact.

= 1.8.3 =
* Connect SendBeam: one button connects the site and hands it a key with exactly the permissions you tick, and can add your sending domain at the same time. Pasting a key by hand still works.
* SendBeam has its own menu, with a page for each section: Overview, Forms, Pop-ups, Audience, Site email, E-commerce, Settings and Help. Old Settings → SendBeam links redirect.
Expand Down
4 changes: 2 additions & 2 deletions sendbeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: SendBeam
* Plugin URI: https://sendbeam.io/docs/wordpress
* Description: Newsletter signup forms, pop-ups, opt-ins at registration and checkout, and your site's own email, from your SendBeam account.
* Version: 1.8.3
* Version: 1.8.4
* Requires at least: 6.1
* Requires PHP: 7.4
* Author: SendBeam
Expand All @@ -17,7 +17,7 @@

defined( 'ABSPATH' ) || exit;

define( 'SENDBEAM_VERSION', '1.8.3' );
define( 'SENDBEAM_VERSION', '1.8.4' );
define( 'SENDBEAM_FILE', __FILE__ );
define( 'SENDBEAM_DIR', plugin_dir_path( __FILE__ ) );

Expand Down
1 change: 1 addition & 0 deletions tests/smoke.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ function sb_log_reset() {
sendbeam_ecommerce_on_order_placed( 501 );
ok( 1 === count( $stub['cron'] ) && SENDBEAM_ECOMMERCE_HOOK === $stub['cron'][0]['hook'], 'order placed: queued as a single cron event, like every other subscription' );
$sendbeam_order_job = $stub['cron'][0]['args'][0];
ok( '501' === $sendbeam_order_job['order_id'] && ! empty( $sendbeam_order_job['placed_at'] ) && false !== strtotime( $sendbeam_order_job['placed_at'] ), 'order placed: carries the order id and the time it was placed, so SendBeam stores and attributes it (#105)' );
ok( 'order_placed' === $sendbeam_order_job['type'] && 'buyer@example.test' === $sendbeam_order_job['email'] && 'Ada Lovelace' === $sendbeam_order_job['name'] && 84.5 === $sendbeam_order_job['value'] && 'GBP' === $sendbeam_order_job['currency'], 'order placed: name, total and currency are read from the order' );

$stub['remote'] = array();
Expand Down
1 change: 1 addition & 0 deletions tests/woocommerce-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function get_billing_last_name() { return isset( $this->data['last_name']
public function get_total() { return isset( $this->data['total'] ) ? $this->data['total'] : 0; }
public function get_currency() { return isset( $this->data['currency'] ) ? $this->data['currency'] : 'USD'; }
public function get_id() { return isset( $this->data['id'] ) ? $this->data['id'] : 0; }
public function get_date_created() { return new DateTime( '2026-09-25T08:00:00+00:00' ); }
// Order meta lives in the shared stub store, keyed by order id, so a
// second WC_Order for the same id sees what the first one saved.
public function get_meta( $key ) { $id = $this->get_id(); return isset( $GLOBALS['stub']['wc_order_meta'][ $id ][ $key ] ) ? $GLOBALS['stub']['wc_order_meta'][ $id ][ $key ] : ''; }
Expand Down
Loading