Skip to content

Shipping Block Extension #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions smart-send-logistics/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Import the default config file and expose it in the project root.
// Useful for editor integrations.
module.exports = require( '@wordpress/prettier-config' );
13 changes: 13 additions & 0 deletions smart-send-logistics/block.json
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file actually used or a left over? There is also a src/js/shipping-workshop-block/block.json file?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The smart-send-logistics/block.json file is indeed used and not a leftover. It is responsiblefor registering the main shipping workshop block in WooCommerce and informing WordPress about the block's associated script and style files. This ensures that the block is properly integrated and functional within the WordPress and WooCommerce environments.On the other hand, the src/js/shipping-workshop-block/block.json file is used to define the inner blocks, their specific configurations, and essential details. This file provides information necessary for the proper rendering and behaviour of the inner blocks within the shipping workshop block.Both files are crucial for the correct setup and operation of the shipping workshop block and its components.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "create-block/shipping-workshop",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name does not follow the specs: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#name

The name for a block is a unique string that identifies a block. Names have to be structured as namespace/block-name, where namespace is the name of your plugin or theme.

Suggested change
"name": "create-block/shipping-workshop",
"name": "smart-send/pick-up-points",

"version": "1.0.0",
"title": "Shipping Workshop",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title should be the displayed name.

Consider something like:

Suggested change
"title": "Shipping Workshop",
"title": "Pick-up Point checkout",

"category": "widgets",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a description:

Suggested change
"category": "widgets",
"description": "Show pick-up point selector during checkout for relevant shipping methods"
"category": "widgets",

"icon": "palmtree",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"icon": "palmtree",
"icon": "list-view",

"textdomain": "shipping-workshop",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to match the plugin's Text Domain

Suggested change
"textdomain": "shipping-workshop",
"textdomain": "smart-send-logistics",

"editorScript": "file:./build/index.js",
"editorStyle": "file:./build/index.css",
"style": "file:./build/style-index.css"
}
1 change: 1 addition & 0 deletions smart-send-logistics/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('wp-plugins'), 'version' => '3f3d50b7ebd74f8ef2af');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<?php return array('dependencies' => array('wp-plugins'), 'version' => '3f3d50b7ebd74f8ef2af');
<?php
return array(
'dependencies' => array('wp-plugins'),
'version' => '3f3d50b7ebd74f8ef2af',
);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this version come from?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version Number is coming from our plugin main file

101 changes: 101 additions & 0 deletions smart-send-logistics/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions smart-send-logistics/build/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions smart-send-logistics/build/js/shipping-workshop-block/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"apiVersion": 2,
"name": "shipping-workshop/shipping-workshop-block",
"version": "2.0.0",
"title": "Alternative Shipping Options Block",
"category": "woocommerce",
"description": "Adds a select field to let the shopper choose alternative shipping instructions.",
"supports": {
"html": false,
"align": false,
"multiple": false,
"reusable": false
},
"parent": [
"woocommerce/checkout-shipping-methods-block"
],
"attributes": {
"lock": {
"type": "object",
"default": {
"remove": true,
"move": true
}
},
"text": {
"type": "string",
"default": ""
}
},
"textdomain": "shipping-workshop",
"editorStyle": "file:../../../build/style-shipping-workshop-block.css"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'ae8ec2a68155879c014d');
Loading