这是按钮的代码:
{% assign p_annual = all_products[section.settings.paid_product_annual] %}
{% assign p_free = all_products[section.settings.free_product] %}
{% if section.settings.productlink1label != blank %}
<button class="btn"
type="submit"
name="paid-plan"
id="paid-plan-option-annual"
data-variant-id="{{ p_annual.selected_or_first_available_variant.metafields.subscriptions.discount_variant_id }}"
data-variant-interval-value="{{ p_annual.metafields.subscriptions.shipping_interval_frequency }}"
data-variant-interval-unit="{{ p_annual.metafields.subscriptions.shipping_interval_unit_type }}"
data-quickadd-id="{{ p_annual.selected_or_first_available_variant.id }}"
data-quickadd-properties
>
{{ p_annual.selected_or_first_available_variant.price | money_without_trailing_zeros }}{{ section.settings.productlink1label }}
</button>
{% endif %}
Run Code Online (Sandbox Code Playgroud)
该代码通过 ID 获取项目并发出 AJAX 请求。
// quick add
_document.on('click', '[data-quickadd-id]', function() {
let _this = $(this);
loadingBarTrigger('start');
itemAdd(
_this.attr('data-quickadd-id'),
_this.attr('data-quickadd-properties'),
(_this.attr('data-quickadd-quantity'))
? _this.attr('data-quickadd-quantity')
: 1,
(!html.is('#cart')) ? true : false,
(html.is('#cart')) …Run Code Online (Sandbox Code Playgroud) 情况
我正在尝试调用Shopify REST API,其中有超过 50-250 个结果,但我无法从包含Pagination Links 的cURL Response 中获取链接标头。
Cursor-Pagination API 文档中的链接标头示例( https://shopify.dev/tutorials/make-paglated-requests-to-rest-admin-api )
#...
Link: "<https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={page_info}&limit={limit}>; rel={next}, <https://{shop}.myshopify.com/admin/api/{version}/products.json?page_info={page_info}&limit={limit}>; rel={previous}"
#...
Run Code Online (Sandbox Code Playgroud)
链接rel参数确实显示,但链接为空,如下所示。
我的 Shopify 通话功能
function shopify_call($token, $shop, $api_endpoint, $query = array(), $method = 'GET', $request_headers = array()) {
// Build URL
$url = "https://" . $shop . ".myshopify.com" . $api_endpoint;
if (!is_null($query) && in_array($method, array('GET', 'DELETE'))) $url = $url . "?" . http_build_query($query);
$headers = [];
// Configure cURL
$curl …Run Code Online (Sandbox Code Playgroud) 我正在进行 Shopify 版本控制,因为我无法获取页面数据。我回顾了 API 新版本,因为我显示了 page_info 在哪里获取 page_info
$api_url = 'https://6b4c824f22b4f24ddewwerew0a9b36397fd27e5c4:a5cb5dd808ec7392ewrewrwerwerwed8872be5aa5d3b1c@bacsolution-4.myshopify.com/admin/api/2020-01/products.json?limit='.$limit.';rel=next';
//$api_url = 'https://'.$shop.'/admin/products.json?limit='.$limit.'&page='.$i.'';
//$fieldstoselect = 'id,title,variants';
$fieldstoselect = 'id,title';
$api_url = $api_url.'&fields='.$fieldstoselect;
$headr = array();
$headr[] = 'Content-Type: application/json';
//$headr[] = 'X-Shopify-Access-Token:'.$token;
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$res = curl_exec($ch);
$response_all = json_decode($res);
echo "<pre>";
print_r($response_all);
exit;
Run Code Online (Sandbox Code Playgroud) 在 Shopify 中,似乎有 2 个区域可以上传站点图像:文件(设置 -> 文件)和资产(主题编辑器 -> 资产文件夹)。这里有什么区别,为什么要将图像放在一个之上?