Compare commits

...

20 Commits

Author SHA1 Message Date
3wc
8a17a922ac Allow overwriting during deployment
Some checks reported errors
continuous-integration/drone/push Build was killed
2024-07-16 18:39:31 -04:00
3wc
960d6a22f2 Fix path for Drone deployment
Some checks failed
continuous-integration/drone/push Build is failing
2024-07-16 18:36:13 -04:00
3wc
9e049f7fa6 Add live site Drone
Some checks failed
continuous-integration/drone/push Build is failing
2024-07-16 18:34:02 -04:00
3wc
2e30e12488 Working sync-from-live
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-16 18:27:36 -04:00
3wc
a9b655e04f Fix incorrect label generation
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-16 18:23:17 -04:00
3wc
5832b48479 Initialise is_organic to avoid warning 2024-07-10 19:48:04 -04:00
3wc
7890a955ce Add makefile rule to export theme ZIP
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-10 19:40:10 -04:00
3wc
986f7d8856 Bump version number for clarity
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-10 19:37:17 -04:00
52e97d16d8 whoopsie, extraneous code
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-10 19:32:49 -04:00
45c13bf515 test for existence of shipping address and use that, otherwise use billing address
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-10 19:31:36 -04:00
3wc
70886ea67d Further fix to array handling
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-09 14:30:08 -04:00
83be51bf32 dont print error
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-09 14:20:39 -04:00
3wc
6f3069bee9 Handle previous orders without coffees assigned
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-09 14:17:39 -04:00
cd14c04689 error handling
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-09 14:12:14 -04:00
3wc
dfdf13cf6f Initialise $is_new to prevent warning on live site
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-09 00:19:57 -04:00
3wc
39ba56eca6 Fix crash on renewal..
All checks were successful
continuous-integration/drone/push Build is passing
..again?
2024-07-08 23:52:39 -04:00
d6004d6cb3 they wanted customer name a bit bigger, was not legible on the print
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-07 12:55:08 -04:00
3wc
e7f5673a19 Fix coffee list rotation
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-05 19:01:24 -04:00
3wc
0852986599 Revert "testing renewal fix, issue 3270"
This reverts commit 7563c632f5.
2024-07-05 18:55:32 -04:00
3wc
b3f48f098c Wider area for "origin" to avoid line breaks 2024-07-05 18:50:15 -04:00
8 changed files with 166 additions and 73 deletions

View File

@ -2,7 +2,7 @@
kind: pipeline kind: pipeline
name: deploy main branch to live site name: deploy main branch to live site
steps: steps:
- name: docker cp deploy - name: copy theme files to staging
image: git.coopcloud.tech/coop-cloud/docker-cp-deploy:latest image: git.coopcloud.tech/coop-cloud/docker-cp-deploy:latest
settings: settings:
host: smol-wp.autonomic.zone host: smol-wp.autonomic.zone
@ -12,6 +12,19 @@ steps:
dest: /var/www/html/ dest: /var/www/html/
deploy_key: deploy_key:
from_secret: drone_ssh_smol-wp.autonomic.zone from_secret: drone_ssh_smol-wp.autonomic.zone
when:
branch:
- staging
- name: copy theme files to live
image: appleboy/drone-scp
settings:
host: web1.mont58coffee.com
username: autonomic
overwrite: true
key:
from_secret: drone_ssh_mont58coffee.com
target: /var/www/production.mont58coffee.com/web/
source: wp-content/themes/mont58-coffee/
when: when:
branch: branch:
- main - main

View File

@ -2,6 +2,10 @@
# REQUIRED SETTINGS (you will need these) # # REQUIRED SETTINGS (you will need these) #
############################################################################## ##############################################################################
# run `make fetch_db_info` to find these out
DB_USER=
DB_PASSWORD=
DB_NAME=
############################################################################## ##############################################################################
# COMMON SETTINGS (you may need these) # # COMMON SETTINGS (you may need these) #
@ -37,5 +41,10 @@ PROJECT_NAME=mont58
# Site URL, also just needs to be set once per project # Site URL, also just needs to be set once per project
SITE_URL=mont58-staging.smol-wp.autonomic.zone SITE_URL=mont58-staging.smol-wp.autonomic.zone
SSH_USER=autonomic
SSH_HOST=web1.mont58coffee.com
SSH_PATH=/var/www/production.mont58coffee.com/web/
SSH_PORT=22
# Multi-site config # Multi-site config
#WORDPRESS_CONFIG_EXTRA="define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('DOMAIN_CURRENT_SITE', 'frms.localhost'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define('SUNRISE', true);" #WORDPRESS_CONFIG_EXTRA="define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); define('DOMAIN_CURRENT_SITE', 'frms.localhost'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define('SUNRISE', true);"

View File

@ -22,12 +22,14 @@ services:
- WORDPRESS_DB_NAME=wordpress - WORDPRESS_DB_NAME=wordpress
- WORDPRESS_CONFIG_EXTRA=${WORDPRESS_CONFIG_EXTRA} - WORDPRESS_CONFIG_EXTRA=${WORDPRESS_CONFIG_EXTRA}
- WORDPRESS_DEBUG=${WORDPRESS_DEBUG} - WORDPRESS_DEBUG=${WORDPRESS_DEBUG}
- WORDPRESS_TABLE_PREFIX=kM7KXt7HQ_
- PHP_EXTENSIONS=calendar - PHP_EXTENSIONS=calendar
- PAGER=more - PAGER=more
container_name: "${PROJECT_NAME}_wordpress" container_name: "${PROJECT_NAME}_wordpress"
db: db:
image: "mariadb:10.6" image: "mariadb:10.6"
command: --innodb-buffer-pool-size=10G
volumes: volumes:
- "${MARIADB_VOLUME:-mariadb}:/var/lib/mysql" - "${MARIADB_VOLUME:-mariadb}:/var/lib/mysql"
networks: networks:

View File

@ -8,6 +8,8 @@ if [ -n "$PHP_EXTENSIONS" ]; then
done done
fi fi
echo 'memory_limit = 2048M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini;
if ! id -u "user" >/dev/null ; then if ! id -u "user" >/dev/null ; then
useradd -u 1000 -m user useradd -u 1000 -m user
mkdir /var/www/html/vendor mkdir /var/www/html/vendor

View File

@ -109,14 +109,53 @@ uploads_load:
## Sync wp-content from site ## Sync wp-content from site
uploads_pull: uploads_fetch uploads_load uploads_pull: uploads_fetch uploads_load
fetch_db_info:
ssh -p$(SSH_PORT) $(SSH_USER)@$(SSH_HOST) grep DB $(SSH_PATH)/wp-config.php
## Download database from dev site ## Download database from dev site
db_fetch: db_fetch:
$(ABRA) app run $(SITE_URL) db bash -c 'mariadb-dump -u root -p"$$(cat /run/secrets/db_root_password)" wordpress' | gzip > data/dbdump.sql.gz ssh -p$(SSH_PORT) autonomic@web1.mont58coffee.com mysqldump -u $(DB_USER) -p$(DB_PASSWORD) "$(DB_NAME)" | gzip > data/dbdump.sql.gz
## Load latest database from ~/.abra/backups ## Load latest database from ~/.abra/backups
db_load: db_load:
zcat data/dbdump.sql.gz | $(_DOCKER_COMPOSE) exec -T db mysql -u wordpress -pwordpress wordpress zcat data/dbdump.sql.gz | $(_DOCKER_COMPOSE) exec -T db mysql -u wordpress -pwordpress wordpress
db_pull: db_fetch db_load fix_url
define SQL_HEADER
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
endef
export SQL_HEADER
define SQL_FOOTER
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
endef
export SQL_FOOTER
db_convert:
gunzip data/database.sql.gz
sed -i -e 's/SERVMASK_PREFIX/wp/g' -e 's/,0x,/,0,/g' data/database.sql
echo "$$SQL_HEADER" | cat - data/database.sql > data/database_wrapped.sql
echo "$$SQL_FOOTER" >> data/database_wrapped.sql
mv data/database_wrapped.sql data/database.sql
## Replace site URL ## Replace site URL
fix_url: fix_url:
$(_DOCKER_COMPOSE) exec -u user wordpress wp --url=https://$(SITE_URL) search-replace --all-tables-with-prefix 'https://$(SITE_URL)' 'http://$(PROJECT_NAME).localhost' $(_DOCKER_COMPOSE) exec -u user wordpress wp --url=https://$(SITE_URL) search-replace --all-tables-with-prefix 'https://$(SITE_URL)' 'http://$(PROJECT_NAME).localhost'
@ -125,18 +164,8 @@ fix_url:
set_local_password: set_local_password:
$(_DOCKER_COMPOSE) exec -u user wordpress wp user update $(USERNAME) --user_pass=password $(_DOCKER_COMPOSE) exec -u user wordpress wp user update $(USERNAME) --user_pass=password
db_pull: db_fetch db_load fix_url plugins_pull:
rsync -Pavz -e 'ssh -p$(SSH_PORT)' $(SSH_USER)@$(SSH_HOST):$(SSH_PATH)/wp-content/plugins/ wp-content/plugins/
## Download wp-content files from site
plugins_fetch:
$(ABRA) app run --no-tty $(SITE_URL) app tar --owner=0 --group=0 --no-same-owner --no-same-permissions -czf- /var/www/html/wp-content/plugins/ > data/plugins.tar.gz
## Load latest plugins from data/plugins.tar.gz
plugins_load:
tar -C wp-content --strip-components=4 -xzf data/plugins.tar.gz
## Sync plugins from site
plugins_pull: plugins_fetch plugins_load
## Download parent theme from site ## Download parent theme from site
theme_fetch: theme_fetch:
@ -149,6 +178,14 @@ theme_load:
## Sync wp-content from site ## Sync wp-content from site
theme_pull: theme_fetch theme_load theme_pull: theme_fetch theme_load
#######################################
# Releases
#######################################
# Generate ZIP of theme
theme_export:
cd wp-content/themes/mont58-coffee/ && zip -r ../../../data/mont58-theme_2024-07-09.zip . && cd -
# "Arguments" for makefiles.. # "Arguments" for makefiles..
# https://stackoverflow.com/a/6273809/1826109 # https://stackoverflow.com/a/6273809/1826109
%: %:

View File

@ -63,13 +63,6 @@ add_filter(
* License: GPL2 * License: GPL2
*/ */
/**
* Process coffee items for an order
*
* @param WC_Order $order The order to process
* @param array &$order_coffees Reference to array to store processed coffees
* @param array &$seen_subscriptions Reference to array tracking seen subscriptions
*/
function process_coffee_items($order, &$order_coffees, &$seen_subscriptions) function process_coffee_items($order, &$order_coffees, &$seen_subscriptions)
{ {
// Iterate through all items in the order // Iterate through all items in the order
@ -77,9 +70,12 @@ function process_coffee_items($order, &$order_coffees, &$seen_subscriptions)
// Check if the item is a subscription (based on name containing "subscription") // Check if the item is a subscription (based on name containing "subscription")
if (stripos($order_item->get_name(), "subscription") !== false) { if (stripos($order_item->get_name(), "subscription") !== false) {
// Get the coffee list associated with the subscription item // Get the coffee list associated with the subscription item
$coffee_list = get_field("coffee_list", $order_item->get_product_id()); $coffee_list = get_field(
"coffee_list",
$order_item->get_product_id()
);
// Skip this item if no coffee list is found // TODO log or display this error
if (!$coffee_list) { if (!$coffee_list) {
continue; continue;
} }
@ -93,24 +89,26 @@ function process_coffee_items($order, &$order_coffees, &$seen_subscriptions)
for ($x = 0; $x < $item_quantity; $x++) { for ($x = 0; $x < $item_quantity; $x++) {
$coffee_list_id = $coffee_list->ID; $coffee_list_id = $coffee_list->ID;
// Initialize the seen count for this coffee list if not set // Check if this coffee list has been seen before in this order
if (!isset($seen_subscriptions[$coffee_list_id])) { if (array_key_exists($coffee_list_id, $seen_subscriptions)) {
// Increment the count of times this coffee list has been encountered
$seen_subscriptions[$coffee_list_id]++;
// Calculate the index to select a coffee from the list
$index = $seen_subscriptions[$coffee_list_id];
$coffee =
$coffees_in_list[$index % sizeof($coffees_in_list)];
} else {
// If this coffee list is encountered for the first time in this order
$seen_subscriptions[$coffee_list_id] = 0; $seen_subscriptions[$coffee_list_id] = 0;
// Select the last coffee from the list
$coffee = array_pop(array_reverse($coffees_in_list));
} }
// Calculate the index to select a coffee from the list
$index = $seen_subscriptions[$coffee_list_id];
// Select the coffee using the calculated index
$coffee = $coffees_in_list[$index % count($coffees_in_list)];
// Add the selected coffee with its associated coffee list to the order_coffees array // Add the selected coffee with its associated coffee list to the order_coffees array
array_push($order_coffees, [ array_push($order_coffees, [
"coffee_list" => $coffee_list, "coffee_list" => $coffee_list,
"coffee" => $coffee, "coffee" => $coffee,
]); ]);
// Increment the seen count for this coffee list
$seen_subscriptions[$coffee_list_id]++;
} }
} }
} }
@ -133,22 +131,20 @@ function action_woocommerce_new_order($order_id, $order)
add_action("woocommerce_new_order", "action_woocommerce_new_order", 10, 2); add_action("woocommerce_new_order", "action_woocommerce_new_order", 10, 2);
// Handle renewal order creation event // Handle renewal order creation event
/**
* Handle renewal order creation event
*
* @param WC_Order $order The new renewal order
* @param WC_Subscription $subscription The subscription object
*/
function action_wcs_renewal_order_created($order, $subscription) function action_wcs_renewal_order_created($order, $subscription)
{ {
// Retrieve related orders of the subscription excluding the current renewal order // Retrieve related orders of the subscription excluding the current renewal order
$last_orders = wcs_get_subscription($subscription)->get_related_orders("ids", ["parent", "renewal"]); $last_orders = wcs_get_subscription($subscription)->get_related_orders(
"ids",
["parent", "renewal"]
);
unset($last_orders[$order->get_ID()]); unset($last_orders[$order->get_ID()]);
// If there are previous orders related to the subscription // If there are previous orders related to the subscription
if (sizeof($last_orders) > 0) { if (sizeof($last_orders) > 0) {
// Get the ID of the most recent previous order // Get the ID of the most recent previous order
$last_order_id = max($last_orders); $last_order_id = max($last_orders);
$last_order = wc_get_order($last_order_id);
// Get the processed coffees from the most recent previous order // Get the processed coffees from the most recent previous order
$last_order_coffees = get_field("coffees", $last_order_id); $last_order_coffees = get_field("coffees", $last_order_id);
@ -156,31 +152,47 @@ function action_wcs_renewal_order_created($order, $subscription)
$order_coffees = []; $order_coffees = [];
$seen_subscriptions = []; $seen_subscriptions = [];
// Initialize $seen_subscriptions based on the last order's coffees if ($last_order_coffees) { // Check last_order_coffees isn't null or false
foreach ($last_order_coffees as $last_order_coffee) { // Get the latest coffee seen in each coffee list from the previous order
$coffee_list_id = $last_order_coffee["coffee_list"]->ID; foreach (array_reverse($last_order_coffees) as $last_order_coffee) {
if (!isset($seen_subscriptions[$coffee_list_id])) { if (
// Find the position of the last coffee in its list array_key_exists(
$last_order_coffee["coffee_list"]->ID,
$seen_subscriptions
)
) {
continue;
}
$position_in_list = array_search( $position_in_list = array_search(
$last_order_coffee["coffee"]->ID, $last_order_coffee["coffee"]->ID,
get_field("coffees", $last_order_coffee["coffee_list"]->ID) $last_order_coffee["coffee_list"]->coffees
); );
// Set the next position (or 0 if not found) if ($position_in_list === false) {
$seen_subscriptions[$coffee_list_id] = $position_in_list !== false ? $position_in_list + 1 : 0; // ignore this, can't find it in list anymore
continue;
}
$seen_subscriptions[
$last_order_coffee["coffee_list"]->ID
] = $position_in_list;
} }
} }
// Process coffee items for the new renewal order // Process coffee items based on the coffees in the last order
process_coffee_items($order, $order_coffees, $seen_subscriptions); process_coffee_items($last_order, $order_coffees, $seen_subscriptions);
// Update the custom field "coffees" with the processed coffee data for the current renewal order // Update the custom field "coffees" with the processed coffee data for the current renewal order
update_field("coffees", $order_coffees, $order->get_ID()); update_field("coffees", $order_coffees, $order->get_ID());
} }
return $order;
} }
// Hook the above function to the 'wcs_renewal_order_created' action // Hook the above function to the 'wcs_renewal_order_created' action
add_action("wcs_renewal_order_created", "action_wcs_renewal_order_created", 10, 2); add_action(
"wcs_renewal_order_created",
"action_wcs_renewal_order_created",
10,
2
);
// Add a sidepanel on WooCommerce order pages // Add a sidepanel on WooCommerce order pages
add_action("add_meta_boxes", "mont58_coffee_label_add_sidepanel"); add_action("add_meta_boxes", "mont58_coffee_label_add_sidepanel");

View File

@ -2,6 +2,6 @@
Theme Name: Mont58 Coffee Theme Name: Mont58 Coffee
Description: Theme for mont58coffee.com - child theme of Bridge Description: Theme for mont58coffee.com - child theme of Bridge
Template: bridge Template: bridge
Version: 1.0.0 Version: 1.1.0
Text Domain: mont58coffee Text Domain: mont58coffee
*/ */

View File

@ -76,7 +76,6 @@ if(!is_user_logged_in()){
min-height: 3mm; min-height: 3mm;
font-variation-settings: 'wdth' 70, 'wght' 600; font-variation-settings: 'wdth' 70, 'wght' 600;
margin-inline: auto; margin-inline: auto;
width: 90%;
} }
.label .product-details .origin.non-coffee { .label .product-details .origin.non-coffee {
@ -100,16 +99,13 @@ if(!is_user_logged_in()){
text-align: center; text-align: center;
width: 100%; width: 100%;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 2.2mm; /* so that names as long as 50 characters stay on one line */ font-size: 2.9mm; /* so that names as long as 50 characters stay on one line */
margin-top: 4.6mm; /* to center text inside white area */ margin-top: 4.6mm; /* to center text inside white area */
position: absolute; position: absolute;
bottom: 8mm; /* Adjust this value to set the distance from the bottom of the label */ bottom: 5.9mm; /* Adjust this value to set the distance from the bottom of the label */
left: 0; left: 0;
right: 0; right: 0;
} }
.label .order-details p { .label .order-details p {
margin-block: 0.5mm; margin-block: 0.5mm;
@ -119,13 +115,25 @@ if(!is_user_logged_in()){
<body> <body>
<div class="container"> <div class="container">
<?php <?php
$j = 0;
foreach ($_GET["order_ids"] as $order_id) { foreach ($_GET["order_ids"] as $order_id) {
$order = wc_get_order($order_id); $order = wc_get_order($order_id);
$first_name = $order->get_billing_first_name();
$last_name = $order->get_billing_last_name(); // Check if shipping details exist
$postcode = $order->get_billing_postcode(); $shipping_first_name = $order->get_shipping_first_name();
$shipping_last_name = $order->get_shipping_last_name();
$shipping_postcode = $order->get_shipping_postcode();
// If any shipping detail is empty, use billing details
if (empty($shipping_first_name) || empty($shipping_last_name) || empty($shipping_postcode)) {
$first_name = $order->get_billing_first_name();
$last_name = $order->get_billing_last_name();
$postcode = $order->get_billing_postcode();
} else {
$first_name = $shipping_first_name;
$last_name = $shipping_last_name;
$postcode = $shipping_postcode;
}
$items = $order->get_items(); $items = $order->get_items();
$total_items = $order->get_item_count(); $total_items = $order->get_item_count();
$roast_date = (new DateTime())->modify("-3 days")->format("d/m/Y"); $roast_date = (new DateTime())->modify("-3 days")->format("d/m/Y");
@ -133,14 +141,17 @@ if(!is_user_logged_in()){
$order_subscription_coffees = get_field("coffees", $order_id); $order_subscription_coffees = get_field("coffees", $order_id);
$j = 0; // Reset $j for each order (claude suggested this) $is_new = false;
foreach ($items as $item) { foreach ($items as $item) {
$j = 0;
// checking if product is a coffee // checking if product is a coffee
$product_id = $item->get_product_id(); $product_id = $item->get_product_id();
$product_categories = get_the_terms($product_id, "product_cat"); $product_categories = get_the_terms($product_id, "product_cat");
$is_coffee = false; $is_coffee = false;
$is_subscription = false; $is_subscription = false;
$is_organic = false;
if ( if (
!empty($product_categories) && !empty($product_categories) &&
@ -156,6 +167,9 @@ if(!is_user_logged_in()){
} }
} }
} }
$product_name = '';
$roast = '';
if ($is_coffee || $is_subscription) { if ($is_coffee || $is_subscription) {
$brew_method = $item->get_meta("pa_brew-method"); $brew_method = $item->get_meta("pa_brew-method");
@ -186,11 +200,15 @@ if(!is_user_logged_in()){
$quantity = $item->get_quantity(); $quantity = $item->get_quantity();
for ($i = 0; $i < $quantity; $i++) { for ($i = 0; $i < $quantity; $i++) {
if ($is_subscription) { if ($is_subscription) {
$coffee = $order_subscription_coffees[$i + $j]["coffee"]; if (($order_subscription_coffees !== null)
$product_name = $coffee->post_title; && (is_object($order_subscription_coffees[$i + $j]["coffee"]))){
$roast = get_field("roast_level", $coffee->ID); $coffee = $order_subscription_coffees[$i + $j]["coffee"];
$is_organic = get_field("is_organic", $coffee->ID); $product_name = $coffee->post_title;
} ?> $roast = get_field("roast_level", $coffee->ID);
$is_organic = get_field("is_organic", $coffee->ID);
}
} ?>
<div class="label"> <div class="label">
<div> <div>
<div class="product-details"> <div class="product-details">