Skip to content
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

Custom shipping methods show a zero price #1532

Closed
lukeholder opened this issue Jun 23, 2020 · 3 comments
Closed

Custom shipping methods show a zero price #1532

lukeholder opened this issue Jun 23, 2020 · 3 comments
Assignees

Comments

@lukeholder
Copy link
Member

When viewing custom shipping method options, the price value is shown as zero.

image

@engram-design
Copy link
Contributor

Related to this, I can't seem to call method.getShippingRules() from my custom shipping methods in verbb/postie#36

{% for handle, method in cart.availableShippingMethodOptions %}
    {{ dump(method.getShippingRules()) }}
{% endfor %}

See https://d.pr/i/Tb3xni which is correct for Commerce shipping methods, but not for a shipping method provided by Postie.

@engram-design
Copy link
Contributor

engram-design commented Jan 26, 2022

Looks like this issue might be back in 3.4.x.

image

Here, I'm outputting the available methods with Order::getAvailableShippingMethods() (deprecated) and Order::getAvailableShippingMethodOptions() with only the former approach working correctly.

<h2>availableShippingMethods</h2><br>
    {% for handle, method in cart.availableShippingMethods %}
        {% set price = method.priceForOrder(cart)|commerceCurrency(cart.currency) %}
        
        {{ method.name }} - {{ price }}<br>
    {% endfor %}

    <h2>getAvailableShippingMethodOptions</h2><br>
    {% for handle, method in cart.getAvailableShippingMethodOptions %}
        {% set price = method.priceForOrder(cart)|commerceCurrency(cart.currency) %}
        
        {{ method.name }} - {{ price }}<br>
    {% endfor %}

    <br><br>

The top 3 are Commerce-created methods, the others are Postie-provided ones.

@lukeholder lukeholder self-assigned this Jan 28, 2022
@lukeholder lukeholder reopened this Jan 28, 2022
@lukeholder
Copy link
Member Author

Believe this is fixed. If it isn't please raise a new issue with steps to reproduce. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants